Add automated AI pull-request review and workflow lint gate #1
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/ai-pr-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Mirrors the
forgejo-auto-pr-reviewsetup fromnixos-configontoredview, using the same shared ollama infrastructure (nova.mesh:11434,qwen3.6:35b-a3b-q8_0).Changes
.forgejo/workflows/ai-review.yml(new) — triggers an advisory AI review onopened,reopened,synchronize, andready_for_reviewevents, plusworkflow_dispatch. Runs on thenovarunner. Same fork-guard and concurrency cancellation as nixos-config..forgejo/ai-review.yml(new) — provider config and deterministic gate. Usesnpm test(120s timeout) as the authoritative check; this exercises the 16-test suite including the schema migration tests andopenapi-routes.test.js, so the AI review always has evidence that routes are documented and migrations are intact..forgejo/ai-review.md(new) — architecture-specific guidance for the AI reviewer: appended-onlydb.jsmigrations, the@openapiJSDoc policy,lib/path-safety.jsfor any new file-serving code, the tagger/Dockerfile matrix, and the no-build-step vanilla JS SPA rule..forgejo/workflows/docker-build.yml(modified) — newlintjob that downloadsactionlintviacurland runs it across all workflows before any Docker build is started. The forgejo action URL forforgejo-auto-pr-reviewis in theactionlintignore list (same approach as nixos-config'sattic-cache.yml).build-amdnowneeds: lint, so a failed lint blocks the three image builds. Container builds are now gated ongithub.event_name == 'push'— PRs only run thelintjob, no image builds or registry pushes..github/actionlint.yaml(new) — declares thedocker/novaself-hosted runner labels, ignores the forgejo action URL format, and ignoresforgejo.*expression-context warnings (actionlint doesn't understand the Forgejo extension).Deployment note
The
AI_REVIEW_FORGEJO_TOKENsecret must be set on theredviewrepository (or org) in Forgejo before the review workflow can post comments. Without it, the review job will fail to publish its advisory comment but the workflow itself will still run end-to-end.Why
npm testas the deterministic gateThe 16 test files give the reviewer strong evidence about the codebase without needing any external infrastructure:
openapi-routes.test.js— every route has a matching@openapiblockdb-migrations.test.js— migration framework produces correct schemaauth.test.js,dedup.test.js, etc. — business logic gatesThis catches the most common classes of regression (undocumented routes, broken migrations, broken business logic) before the AI even sees the diff.
Why PRs skip the container builds
Building three image variants (AMD, NVIDIA, CPU) and pushing them to the registry on every commit to every PR branch is a lot of wasted CI time and registry churn. The
docker-build.ymlworkflow now distinguishes:pushevents — full pipeline: prepare tags → notify start → lint → build AMD → build NVIDIA → build CPU → notify on failure. The lint job still runs first as a gate.pull_requestevents — only thelintjob runs. Theprepare_tags,notify-start, threebuild-*jobs, andnotify-failureare all skipped viaif: github.event_name == 'push'.This keeps the build/push pipeline for the actual deployment (push to
main) and uses the lighter lint check on PRs.Known limitation: this PR's own AI review
The reviewer reads
.forgejo/ai-review.ymlfrom the base commit of the PR (the trusted revision, so a PR can't change its own review config). On the very first PR that introduces the config, the base doesn't have it yet, so the review job will fail withprovider.model or OLLAMA_MODEL is required. This is upstream behaviour and tracked at nimmo/forgejo-auto-pr-review#22 — every PR after this one will be reviewed normally.Test plan
lintjob passes on this PR (validates workflow syntax withactionlint)lintruns forpull_request)AI_REVIEW_FORGEJO_TOKENsecret is set on the repo/org, then mergecdfc846f00f45fda0f91