# SARIF code scanning

Use the [GitHub Action](/docs/ci/github-actions/) with the following inputs to publish validation diagnostics to GitHub code scanning.

```yaml
with:
  format: sarif
  upload-sarif: true
```

Grant the job `security-events: write` and `contents: read`, and make sure code scanning is available for the repository. The action uploads the report before it fails a job for validation errors.

For an existing CI job that uploads its own report, generate the file with the [command line](/docs/cli/). A validation failure can still produce a report, so allow the upload step to run after the checker exits.
