Skip to content

ci: add Gavel AI code review for pull requests - #15

Merged
chris-regnier merged 2 commits into
mainfrom
ci/add-gavel-review
Feb 18, 2026
Merged

ci: add Gavel AI code review for pull requests#15
chris-regnier merged 2 commits into
mainfrom
ci/add-gavel-review

Conversation

@chris-regnier

Copy link
Copy Markdown
Owner

Summary

  • Add Gavel as an AI-powered code review gate in CI, running on pull requests
  • Configure OpenRouter provider with anthropic/claude-haiku-4-5 and the shall-be-merged policy
  • Upload SARIF findings to GitHub Code Scanning for inline annotations
  • Gracefully skip analysis if the diff is empty or the Gavel binary can't be downloaded

Test plan

  • Open a test PR and verify the Gavel Analysis job runs
  • Confirm the step summary shows the verdict decision and reason
  • Verify SARIF results appear in the Security > Code Scanning tab
  • Confirm test and lint jobs are unaffected

🤖 Generated with Claude Code

chris-regnier and others added 2 commits February 17, 2026 07:39
Introduce Gavel-based PR analysis using OpenRouter
(anthropic/claude-haiku-4-5). Add .gavel/policies.yaml with the
shall-be-merged policy and a new gavel job in .github/workflows/ci.yml
that runs on pull requests: it computes the PR diff, downloads gavel
v0.4.0, runs analysis, writes a step summary, and uploads SARIF to
GitHub Code Scanning. The job fails the workflow when the verdict is
"reject" to block disallowed changes.

Changes include:
- .gavel/policies.yaml: configure OpenRouter provider and enable the shall-be-merged policy.
- .github/workflows/ci.yml: add a gavel job that runs on PRs, checks out code, generates a diff, downloads and runs gavel, evaluates the verdict (failing on reject), writes a step summary, and uploads SARIF.
- Add graceful fallback: if the diff is empty or the Gavel binary cannot be downloaded, the analysis is skipped with a warning instead of failing CI.

The OPENROUTER_API_KEY secret from the repository is used to call the
model during analysis.
The Gavel CLI outputs BAML logs to stdout before the verdict JSON,
causing 'tee' to capture invalid JSON. Also fix SARIF upload by
copying the file to a known location with .sarif extension.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-advanced-security

Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@chris-regnier
chris-regnier merged commit 13810cf into main Feb 18, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants