Central reusable GitHub Actions workflows for Per Paulsen's repositories. Define the PR-check logic once here; every other repo references it with a tiny caller file (no copy-paste, no drift). Update a workflow here → all consuming repos pick it up on their next run.
| Reusable workflow | Purpose | Stack |
|---|---|---|
node-ci.reusable.yml |
npm ci → ESLint (non-blocking) + Vitest/npm test (blocking) |
Node |
autofix.reusable.yml |
eslint --fix and auto-commit fixes back to the PR branch |
Node |
claude-review.reusable.yml |
Independent fresh-context AI review via anthropics/claude-code-action |
any |
gitleaks.reusable.yml |
Secret scan on the diff | any |
Add one file to the consuming repo at .github/workflows/pr-checks.yml (the /ci-init skill does this automatically). Example for a Node repo:
name: PR Checks
on:
pull_request:
branches: [main]
push:
branches: [main]
# Cancel superseded runs on the same ref (don't waste minutes on rapid pushes).
concurrency:
group: pr-checks-${{ github.ref }}
cancel-in-progress: true
# A called workflow cannot exceed its caller's permissions; grant the union here.
permissions:
contents: write # autofix
pull-requests: write # claude-review
issues: write # claude-review
id-token: write # claude-review OIDC
jobs:
ci:
uses: Per-Paulsen/ci-workflows/.github/workflows/node-ci.reusable.yml@v1
gitleaks:
uses: Per-Paulsen/ci-workflows/.github/workflows/gitleaks.reusable.yml@v1
review:
if: github.event_name == 'pull_request'
uses: Per-Paulsen/ci-workflows/.github/workflows/claude-review.reusable.yml@v1
secrets: inherit
autofix:
if: github.event_name == 'pull_request'
uses: Per-Paulsen/ci-workflows/.github/workflows/autofix.reusable.yml@v1For a non-Node repo, drop the ci and autofix jobs (keep review + gitleaks).
- Add an
ANTHROPIC_API_KEYrepository secret (Settings → Secrets and variables → Actions).secrets: inheritforwards it to the review workflow. Without it, the review step skips cleanly. - Install the Claude GitHub App once (https://github.com/apps/claude, "All repositories"). Required for
claude-review; an API key alone is not enough. claude-reviewonly runs for real oncepr-checks.ymlis on the repo's default branch (a security check skips it on the PR that first introduces it).
Consumers pin to the moving major tag @v1 (recommended), not @main — @main
would break every consumer on a bad push. To publish changes here: commit to main,
then move the tag:
git tag -f v1 && git push -f origin v1Pin to a full commit SHA instead of @v1 for maximum immutability.
node-ciruns a repo-definedtype-checkscript if present (blocking),eslint(non-blocking), andnpm test(blocking).node-ci/autofixaccept an optionalnode-versioninput (default"20").
Hard-won lessons — each of these cost a failed run to discover.
claude-reviewneeds the Claude GitHub App installed, not just the secret. Without https://github.com/apps/claude on the repo you get401: Claude Code is not installed on this repository. TheANTHROPIC_API_KEYsecret alone is not enough.- Caller must declare a top-level
permissions:block. A reusable workflow cannot have more permission than its caller. If the caller grants nothing, the run fails at startup (the reusables needid-token: write+contents/pull-requests/issues: write). continue-on-erroris NOT valid on a job thatuses:a reusable workflow — it causes astartup_failure("workflow file issue"). To make a reusable advisory, putcontinue-on-erroron the step inside the reusable (that's howclaude-reviewis non-blocking).claude-reviewskips/fails on workflow-changing PRs by design. Its anti-tampering check requires the running workflow file to match the default branch. On the PR that first adds it → skips (green). On a PR that modifiespr-checks.yml→ the action errors; the reusable'scontinue-on-errorstep keeps the job green. Real reviews run on normal PRs that don't touch the workflow.- Pin consumers to
@v1, never@main. To publish:git tag -f v1 && git push -f origin v1. node-ci/autofixset dummy CI env (DATABASE_URL/AUTH_SECRET/ENCRYPTION_KEY) so Prisma/Auth.js/encryption module-load doesn't crash. CI never touches a real DB.autofixonly fixes auto-fixable rules.no-unused-varsandreact-hooks/*have no fixer, soeslint --fixmay change nothing. To auto-remove unused imports, addeslint-plugin-unused-importsto the repo's eslint config.- Type-check for Next + Vitest: repo script
"type-check": "next typegen && tsc --noEmit"(baretscfails withoutnext-env.d.ts), plus asrc/test/vitest-globals.d.tswith/// <reference types="vitest/globals" />sotscsees the test globals (don't setcompilerOptions.types, it drops the auto-included @types). gh run rerun --faileddoes not reliably re-resolve@v1/@mainreusables to their latest commit. Push a new commit (or move the tag) to force a fresh resolution.- Build is intentionally not run here — Vercel's per-PR preview builds the app.