Add governance-sentinel workflow (hardening Q6)#1
Merged
Conversation
authored-by: agent:claude-cowork.hp-z440 / session:sam.z440-cowork-workspace / t248-hardening-close
There was a problem hiding this comment.
Pull request overview
Adds a new scheduled/on-demand GitHub Actions workflow intended to detect “governance drift” by verifying that default-branch protection (force-push + deletion blocking via rulesets) remains enforced, and opening an alert issue if not.
Changes:
- Introduces a
governance-sentinelworkflow scheduled weekly (Mondays 06:00 UTC) plus manual dispatch. - Uses
gh apito inspect repository rulesets and creates an issue when protections appear missing. - Sets minimal permissions (
administration: read,issues: write) for the sentinel behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+44
to
+50
| for id in $(echo "$rulesets" | jq -r '.[] | select(.enforcement=="active" and .target=="branch") | .id'); do | ||
| rules=$(gh api "repos/$REPO/rulesets/$id" --jq '[.rules[].type] | sort | join(",")') | ||
| echo "active branch ruleset $id -> rules: $rules" | ||
| if echo "$rules" | grep -q "non_fast_forward" && echo "$rules" | grep -q "deletion"; then | ||
| ok=1 | ||
| fi | ||
| done |
Comment on lines
+8
to
+11
| # NOT covered here (GitHub Free + this repo token has no admin:org): org | ||
| # member-change and audit-log alerting — those need an org-level webhook or the | ||
| # audit-log API (GitHub Team/Enterprise) or a PAT with admin:org. See | ||
| # dev/reference/github-org-operations.md §Q6 for the documented remainder. |
|
|
||
| **Expected:** an active \`branch\`-target ruleset carrying \`non_fast_forward\` + \`deletion\` rules on \`$DEFAULT_BRANCH\`. | ||
|
|
||
| **Action:** re-apply per \`dev/reference/github-org-operations.md\` §Q2, or close this issue if the change was intentional. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a scheduled governance-sentinel workflow (hardening Q6).
What it does: every Monday 06:00 UTC (and on demand) it verifies the default-branch protection ruleset (hardening Q2:
non_fast_forward+deletionblock) is stillactive; if it's gone, it opens an alert issue. A failed run also emails the owner, so the check failing is itself a signal.Scope / honest limits: uses only this repo's
GITHUB_TOKEN(no cross-repo secret). Covers force-push + deletion protection loss on the default branch. Not covered — org member-change and audit-log alerting — needs an org webhook / audit-log API (GitHub Team/Enterprise) or a PAT withadmin:org; documented indev/reference/github-org-operations.md§Q6.authored-by: agent:claude-cowork.hp-z440 / session:sam.z440-cowork-workspace / t248-hardening-close