If you want zero per-repository setup, install the GitHub App
instead — it runs the same evaluation server-side with no workflow file and no API key.
The Action is the right choice when you want the configuration in the repository, the
compute on your own runners, or a non-GitHub CI via the REST API.
Setup
1
Issue an API key
Settings → API keys. Name it after the repository so you can revoke
it individually. The key is shown once — copy it now.
2
Validate the key
Before burying it in a secret, prove it works and is scoped to the organisation you
expect:A JSON array of statements means the key is live;
401 means it was mistyped or
deleted. Keys are organisation-scoped — if the statements returned aren’t the corpus
you expect, you’re holding a key from the wrong organisation.3
Store it as a secret
In the repository (or organisation) settings, add it as
POLICYCODEX_API_KEY.4
Add the workflow
Commit the file below to
.github/workflows/policycodex.yml on your default branch..github/workflows/policycodex.yml
fetch-depth: 0 matters — the Action needs the merge base to compute the diff. With a
shallow clone it sees the wrong changes, or none.pull-requests: write is required to post the review.
Inputs
Scoping to a domain
What it does on each run
1
Fetches enforced statements
For the configured domains.
2
Evaluates the diff
Posts the change to
check_compliance, along with the repository file listing so
missing-file requirements are checkable.3
Posts a review
One comment per finding: the statement text, its slug, and the severity.
4
Sets the check result
Fails if any finding maps to an enforced
MUST. SHOULD findings warn only.5
Records the outcome
Violations are written back to PolicyCodex, and the run reports to
Reporting → Scope whether it passed or failed.
Pass and fail
Fails the check
A finding against an enforced
MUST or MUST NOT.Warns only
SHOULD and SHOULD NOT findings, and everything from RFCs still at approved.approved
produces the same comments without blocking anyone, so teams see the work coming before
it becomes mandatory.
Rolling it out
Start with approved, not enforced
Start with approved, not enforced
Add the Action while your standards are still at
approved. Everyone sees the
findings; nobody is blocked. Promote once the noise is manageable.One repository first
One repository first
Run it on a repository whose team is on side. Fix the false positives at the RFC
before ten teams meet them.
Then require the check
Then require the check
Add it to branch protection only after enforcement is genuinely intended.
Watch Reporting → Scope
Watch Reporting → Scope
It tells you which repositories are really running it. Adoption you cannot see
is adoption you do not have.
Troubleshooting
No findings on an obviously non-compliant PR
No findings on an obviously non-compliant PR
Most often the RFC is still at
approved rather than enforced, or the domain
input is scoping it away. Check the LLM is configured too — see
Settings → LLM.The repository never appears in Reporting → Scope
The repository never appears in Reporting → Scope
The Action is not reaching the API. Check
api-base-url and the key. A workflow that
only exists on a feature branch also never runs on subsequent PRs.Findings cite the wrong lines
Findings cite the wrong lines
Usually a shallow clone. Confirm
fetch-depth: 0.
