This guide describes the production model used by LibreSign and LibreCode Coop.
Keep organization-specific policy in the organization's own .github
repository. The shared engine does not need organization-specific code.
A caller needs:
governance.config.json;- a governance workflow;
- a protected environment for GitHub App credentials.
Reference implementations:
Use a GitHub App owned by or trusted by the organization being managed.
The current public-repository model needs repository administration access. GitHub requires administration write access for complete ruleset responses, including bypass actors, even during dry-run.
Keep the App private key in an environment secret. Do not commit it or move it to the shared governance repository.
Recommended caller variables:
RULESET_APP_CLIENT_ID: environment variable;RULESET_APP_PRIVATE_KEY: environment secret.
Create an environment such as ruleset-sync.
Recommended controls:
- restrict deployment branches to
main; - require reviewers for privileged/manual operations where the GitHub plan supports it;
- limit who can administer the environment;
- keep the App private key only in the environment.
The workflow should also reject manually-dispatched privileged jobs outside
main. Environment restrictions remain an independent defense-in-depth layer.
The caller owns the desired rulesets.
A minimal configuration can define one named policy and select it by default:
{
"policies": {
"protected-branches": {
"name": "Protect default branch",
"target": "branch",
"enforcement": "active",
"bypass_actors": [],
"conditions": {
"ref_name": {
"include": ["~DEFAULT_BRANCH"],
"exclude": []
}
},
"rules": [
{"type": "deletion"},
{"type": "non_fast_forward"}
]
}
},
"defaults": {
"policies": ["protected-branches"]
}
}See Configuration for conditions, repository overrides and supported rules.
Never execute a floating branch or major-version tag.
After v0.1.0 is published, use the release commit SHA:
uses: LibreCodeCoop/github-governance/discover@<v0.1.0-commit-sha> # v0.1.0
uses: LibreCodeCoop/github-governance@<v0.1.0-commit-sha> # v0.1.0Dependabot can propose future pinned updates.
Recommended rollout:
- merge caller configuration and workflow;
- run organization-wide dry-run;
- inspect every reported change;
- resolve unexpected drift;
- run one controlled
apply=true; - run dry-run again;
- require zero drift before retiring older automation.
Do not use apply=true as a way to discover what a policy does.
- review Dependabot pull requests;
- keep major dependency upgrades isolated;
- keep action SHAs immutable;
- review policy changes through pull requests;
- run scheduled dry-runs to detect manual drift;
- periodically review GitHub App and environment permissions.