Fix governance-sentinel workflow (Q6): valid perms + optional admin-read PAT#2
Merged
Merged
Conversation
… for ruleset read (Q6) 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
This PR fixes the governance-sentinel GitHub Actions workflow so it becomes parseable/dispatchable again and can optionally use a fine-grained PAT to read repository rulesets (which the default GITHUB_TOKEN cannot access).
Changes:
- Removes the invalid workflow permission key
administration: readto prevent workflow parsing/dispatch failures. - Prefers
${{ secrets.GOVERNANCE_READ_TOKEN || github.token }}forgh apiauthentication so ruleset reads can work when a PAT is configured. - Makes the “permission missing” path explicitly safe-no-op (warning only, no issue created).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+14
| # GITHUB_TOKEN (no `administration` key exists in a workflow `permissions:` | ||
| # block). So set a repo/org secret **GOVERNANCE_READ_TOKEN** = a fine-grained | ||
| # PAT with Administration:read on this repo; the step below prefers it and | ||
| # falls back to GITHUB_TOKEN. WITHOUT that secret the ruleset read 403s and the | ||
| # check SAFE-NO-OPS (logs a note, opens no issue) — it never false-alarms. |
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.
Fixes a bug in the just-merged governance-sentinel (hardening Q6).
Two problems with the merged version:
permissions: administration: readis not a valid workflow permission key → GitHub can't parse the file, so it never runs (422 on dispatch:Unexpected value 'administration').GITHUB_TOKENcannot be granted ruleset-read (repos/<r>/rulesetsneeds the Administration:read repo permission, which has no workflow-permissionskey).This fix:
administrationkey (validcontents: read+issues: writeonly);${{ secrets.GOVERNANCE_READ_TOKEN || github.token }}— set a fine-grained PAT secretGOVERNANCE_READ_TOKEN(Administration:read on this repo) to make the check live; without it the ruleset read 403s and the workflow SAFE-NO-OPS (logs a note, opens no issue — never false-alarms).So it's valid + parseable now, and upgrades to functional the moment the PAT secret is added.
authored-by: agent:claude-cowork.hp-z440 / session:sam.z440-cowork-workspace / t248-hardening-close