# GitHub Action reference

Every input, output, and permission for the [`millionco/react-doctor`](https://github.com/marketplace/actions/react-doctor) Action. For setup and the full workflow file, see [GitHub Actions setup](/docs/ci-and-prs/github-actions-setup).

## Inputs

Set inputs with a `with:` block under the step. Every input is optional.

```yaml
- uses: millionco/react-doctor@v2
  with:
    blocking: warning
    scope: full
```

<table>
  <thead>
    <tr>
      <th>Input</th>
      <th>Default</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <code>blocking</code>
      </td>
      <td>
        <code>none</code>
      </td>
      <td>
        Severity that fails the workflow: <code>error</code>,{" "}
        <code>warning</code>, or <code>none</code> (advisory)
      </td>
    </tr>
    <tr>
      <td>
        <code>scope</code>
      </td>
      <td>
        <code>changed</code>
      </td>
      <td>
        On pull requests, report introduced issues with <code>changed</code>,
        all issues in changed files with <code>files</code>, issues on changed
        lines with <code>lines</code>, modified rule contexts with{" "}
        <code>contextual</code>, or every issue with <code>full</code>. Other
        events always scan the full project
      </td>
    </tr>
    <tr>
      <td>
        <code>comment</code>
      </td>
      <td>
        <code>true</code>
      </td>
      <td>
        Create or update a sticky PR summary comment. Skipped when the pull
        request changes no React files
      </td>
    </tr>
    <tr>
      <td>
        <code>comment-on-clean</code>
      </td>
      <td>
        <code>true</code>
      </td>
      <td>
        When comments are enabled, create a summary comment for a clean scan.
        Set to <code>false</code> to create comments only when the scan finds
        issues. Existing comments still update after a clean scan
      </td>
    </tr>
    <tr>
      <td>
        <code>review-comments</code>
      </td>
      <td>
        <code>true</code>
      </td>
      <td>Post inline review comments on changed lines (pull requests only)</td>
    </tr>
    <tr>
      <td>
        <code>commit-status</code>
      </td>
      <td>
        <code>true</code>
      </td>
      <td>
        Show the score and error and warning counts next to the commit (needs{" "}
        <code>statuses: write</code>)
      </td>
    </tr>
    <tr>
      <td>
        <code>project</code>
      </td>
      <td>
        <code>*</code>
      </td>
      <td>
        Workspace project(s) to scan, comma-separated. <code>*</code> scans
        every discovered project
      </td>
    </tr>
    <tr>
      <td>
        <code>directory</code>
      </td>
      <td>
        <code>.</code>
      </td>
      <td>Project directory to scan</td>
    </tr>
    <tr>
      <td>
        <code>node-version</code>
      </td>
      <td>
        <code>24</code>
      </td>
      <td>Node.js version to use</td>
    </tr>
    <tr>
      <td>
        <code>version</code>
      </td>
      <td>
        <code>latest</code>
      </td>
      <td>
        <code>react-doctor</code> npm version or package spec to run. The
        default <code>latest</code> uses an installed project dependency when
        available. Other values override the installed version
      </td>
    </tr>
  </tbody>
</table>

Install your project dependencies before the Action to use the installed `react-doctor` version.

## Outputs

Read outputs in later steps with `${{ steps.<step-id>.outputs.<name> }}`.

<table>
  <thead>
    <tr>
      <th>Output</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <code>score</code>
      </td>
      <td>Health score (0 to 100). Empty when scoring was unavailable</td>
    </tr>
    <tr>
      <td>
        <code>total-issues</code>
      </td>
      <td>
        Total diagnostics; on pull requests, the number your change introduced
      </td>
    </tr>
    <tr>
      <td>
        <code>fixed-issues</code>
      </td>
      <td>
        On pull requests, the number of issues your change resolved (otherwise
        0)
      </td>
    </tr>
    <tr>
      <td>
        <code>error-count</code>
      </td>
      <td>Error diagnostic count</td>
    </tr>
    <tr>
      <td>
        <code>warning-count</code>
      </td>
      <td>Warning diagnostic count</td>
    </tr>
    <tr>
      <td>
        <code>affected-files</code>
      </td>
      <td>Number of files with diagnostics</td>
    </tr>
  </tbody>
</table>

The `score` output is empty in offline mode, or when the score API is unreachable, so handle that case if you read it in a later step.

## Permissions

A workflow can only read your code by default. The Action needs these added under `permissions:`.

<table>
  <thead>
    <tr>
      <th>Permission</th>
      <th>Why it is needed</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <code>contents: read</code>
      </td>
      <td>Check out and read your code. Required</td>
    </tr>
    <tr>
      <td>
        <code>pull-requests: write</code>
      </td>
      <td>
        Post inline review comments. <code>read</code> also lets the Action use
        the GitHub API when it cannot derive changed files from git
      </td>
    </tr>
    <tr>
      <td>
        <code>issues: write</code>
      </td>
      <td>
        Post the sticky summary comment (a PR comment uses the issues API)
      </td>
    </tr>
    <tr>
      <td>
        <code>statuses: write</code>
      </td>
      <td>
        Show the score and counts next to the commit. Omit if you set{" "}
        <code>commit-status: false</code>
      </td>
    </tr>
  </tbody>
</table>
