Gavel
A CLI toolkit for testing, linting, AI-powered code review, and CI automation.
Install
# From source
go install github.com/flanksource/gavel/cmd/gavel@latest
# Or build locally
task build # also: make build
task install # installs to $GOPATH/bin
Pre-built binaries for Linux, macOS, and Windows are available on the Releases page.
For embedded and externally managed database observability, top-statement
queries, and safe session-storage maintenance, see
PostgreSQL performance diagnostics.
GitHub Action
Run gavel test --lint in CI, upload JSON + HTML artifacts, and post a sticky PR comment with the markdown summary.
Minimal usage
- uses: flanksource/gavel@main
with:
args: test --lint
Full example
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # required when comment=true so the action can post/update the sticky PR comment
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: flanksource/gavel@main
with:
args: test --lint
timeout-minutes: "20"
version: latest
json-file: gavel-results.json
html-file: gavel-results.html
summary-file: gavel-summary.md
artifact-name: gavel-results
comment: "true"
comment-header: gavel
fail-on-error: "true"
If you disable PR commenting (comment: "false"), contents: read is sufficient. Keep pull-requests: write when the action should post or update the sticky PR comment.
Inputs
| Input | Default | Description |
|---|
args | test --lint | Arguments passed to gavel |
working-directory | . | Working directory for execution |
timeout-minutes | 20 | Hard wall-clock limit; timeout diagnostics are printed before the process tree is terminated |
version | latest | Release tag, latest, or source to use a pre-installed binary |
json-file | gavel-results.json | Path for the JSON artifact |
html-file | gavel-results.html | Path for the HTML artifact |
summary-file | gavel-summary.md | Path for the compact markdown summary |
artifact-name | gavel-results | Name of the uploaded artifact bundle |
comment | true | Post/update a sticky PR comment with the summary |
comment-header | gavel | Unique marker for the sticky comment (allows multiple comments per PR) |
github-token | ${{ github.token }} | Token used to post PR comments |
fail-on-error | true | Fail the step when gavel exits non-zero (artifacts are still uploaded) |
gavel-server | — | Upload the results to this hosted gavel with gavel ci upload; gavel test also streams its in-flight results and diagnostics there every 15s, so a killed job keeps its latest state. Needs permissions: id-token: write and a repository linked through the gavel GitHub App |
Outputs
| Output | Description |
|---|
exit-code | Exit code from gavel |
json-path | Absolute path to the JSON artifact |
html-path | Absolute path to the HTML artifact |
summary-path | Absolute path to the markdown summary |
log-path | Absolute path to the stderr log (gavel.log) — always present, even on crash |
The action is crash-resilient: if gavel exits before writing results, placeholder stubs with the exit code and log tail are written so the artifact upload and PR comment still succeed.
Commands
Azure DevOps pull requests
gavel pr status, gavel pr create, gavel commit -p, and the project branch PR API support hosted Azure DevOps. Gavel detects origin URLs at dev.azure.com and legacy visualstudio.com hosts, including HTTPS and SSH remotes. An explicit --repo accepts an Azure repository URL; creation requires it to match origin.
Set AZURE_DEVOPS_EXT_PAT to use a personal access token, or authenticate with az login. A configured PAT takes precedence; an invalid PAT produces an error. Azure CLI tokens are refreshed during long watches. Status requires repository and build read permissions; creation additionally requires code write permission. Git pushes use your existing Git credentials separately.
gavel pr status 27 --logs --tail-logs 100
gavel pr status https://dev.azure.com/acme/product/_git/service/pullrequest/27 --follow
gavel pr status 27 --actions 'CI,Test' --follow --fail-fast
gavel pr create HEAD --base origin/main --draft
gavel commit -p