Setup
1
Issue an API key
Settings → API keys. Name it after the repository so you can revoke
it individually.
2
Store it as a secret
In the repository (or organisation) settings, add it as
POLICYCODEX_API_KEY.3
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
Coverage 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 Coverage
Watch Coverage
Coverage 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 Coverage
The repository never appears in Coverage
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.
