ci: add Gavel AI code review for pull requests - #15
Merged
Conversation
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>
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
anthropic/claude-haiku-4-5and theshall-be-mergedpolicyTest plan
🤖 Generated with Claude Code