# Patent PreCheck — README badge & GitHub Action

Public copy of the integration docs (canonical source: `docs/github-action-badge.md` in the Patent-PreCheck monorepo).

## README badge

```markdown
[![Patent PreCheck scored](https://patentprecheck.com/img/badges/patent-precheck-scored.svg)](https://patentprecheck.com/analyze)
```

Optional shields.io style (npm package):

```markdown
[![npm @patentprecheck/mcp](https://img.shields.io/npm/v/@patentprecheck/mcp?label=mcp)](https://www.npmjs.com/package/@patentprecheck/mcp)
```

## GitHub Actions — public CI (recommended)

Use the downloadable workflow (works from any public repo; no private action pin):

```yaml
# Save from https://patentprecheck.com/downloads/patent-precheck-workflow.yml
# or curl -fsSL -o .github/workflows/patent-precheck.yml \
#   https://patentprecheck.com/downloads/patent-precheck-workflow.yml
```

The workflow runs `npx @patentprecheck/mcp score` against changed source on pull requests.

## GitHub Action (composite — Patent-PreCheck org)

The composite action below is used in Patent-PreCheck org workflows. It is not consumable from public repos while the action repo is private.

```yaml
name: Patent PreCheck

on:
  pull_request:
    paths:
      - '**.ts'
      - '**.tsx'
      - '**.js'
      - '**.py'

jobs:
  patentability:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Patentability score
        uses: Patent-PreCheck/Patent-PreCheck/.github/actions/patent-precheck@v1
        with:
          path: src
          # min-score: '50'
          tier: free
          ai-assistance: yes_some
```

### Inputs

| Input | Default | Description |
|-------|---------|-------------|
| `path` | auto-discover | File or directory to analyze |
| `min-score` | — | Fail when score is below threshold |
| `tier` | `free` | API tier |
| `ai-assistance` | `yes_some` | Declared AI assistance level |
| `fail-on-rate-limit` | `false` | Exit 0 on transient API errors |

### Outputs

- `score` — patentability_score when analyze succeeds
- `file` — analyzed file path

## Command-line (no Actions)

`https://patentprecheck.com/downloads/precheck-from-file.js` — one-file CLI wrapper around `@patentprecheck/mcp`.
