Get your pull request guardrails up and running in minutes.
Create .github/workflows/policy.yml in your repository:
name: policy-gate
on: [pull_request]
jobs:
check-policy:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
- uses: failuresmith/github-policy-gate@v1Create .github/policy-gate.yml to define your rules:
policies:
- id: critical-path-tests
severity: error
when:
changed: ['src/core/**']
require:
changed: ['tests/**']
message: 'Changes to the core engine must include updated tests.'
- id: documentation-check
severity: warn
require:
changed: ['README.md', 'docs/**']
message: 'Consider updating documentation for this change.'Once you push these files, the action will:
- Gather PR facts (changed files, labels, title, etc.).
- Evaluate each policy against those facts.
- Provide a summary in the action logs.
- Add annotations to the PR for any violations.
- Fail the build if any
errorlevel policies are violated.
Don't worry—if you add the action but forget the config file, github-policy-gate will generate a temporary advisory config. It won't block your PRs; it will just show you what an example configuration looks like in the logs.