repo-policy
Lightweight, declarative repository governance for GitHub. Define expected branch protection and ruleset configuration in YAML; audit, preview, and apply it locally or in CI.
Not a Terraform replacement — no state file, no backend. repo-policy is safe to adopt
incrementally on a live repository: by default it only ever touches branches you declare, and
never deletes anything you didn't ask it to manage.
Install
pip install repo-policy
Quick start
# policy.yml
version: 1
branches:
main:
pull_requests:
required: true
approvals: 2
code_owner_review: true
status_checks:
required: [build, test]
signed_commits: true
linear_history: true
allow_force_push: false
allow_deletion: false
repo-policy validate
repo-policy audit --repo acme/widgets
repo-policy plan --repo acme/widgets
repo-policy apply --repo acme/widgets
GitHub Action
- uses: shipsolid/repo-policy@v0
with:
config: .github/repository-policy.yml
mode: audit
The floating tag tracks the current major version (v0 until a 1.0.0 release ships), the same
convention actions/checkout and similar Actions use.
How it works
Every declared branch is diffed against live GitHub state and reconciled through one of two
backends, selected per branch with enforcement: branch_protection | ruleset (default
branch_protection). See the design spec
for the full schema, safety model, and known v1 limitations.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success / compliant / no-op |
| 1 | Drift detected (audit/plan) |
| 2 | Invalid policy.yml |
| 3 | GitHub API or auth error |
License
MIT
Release files for repo-policy 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| repo_policy-0.1.4.tar.gz | 48.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| repo_policy-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.7 kB
Release files / repo_policy-0.1.4.tar.gz
| Download URL | repo_policy-0.1.4.tar.gz |
|---|---|
| Size | 48.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7011e814ce7707ce84a9136c0eba99071f3b970dbfcbaf59c81961bd53dff9a9
|
|
BLAKE2b-256 checksum How to use checksums |
cea05760eb982b39c8cc3cd57f3131eb4b9115e83eb2cb8f895ef6abbfd62db5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / repo_policy-0.1.4-py3-none-any.whl
| Download URL | repo_policy-0.1.4-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd830e8704bd0c28c35ff0a0e791839bad38fca433928f9aee727d4bd4cacdc0
|
|
BLAKE2b-256 checksum How to use checksums |
94cd5a734cc90d87ef26a816f3996b846f2bf493f345951b22f4092d71a3b940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency log