workflows: Let a label pre-authorize protected-file edits - #20
Merged
Conversation
drafter.md and fix.md both fall back to gh-aw's request_review policy whenever an agent-authored change touches protected files (README.md, the workflow definitions themselves, actions-lock.json, etc.) -- see issue #19, where the label-standardization drafter run got stuck there because renaming labels necessarily touches the .md/.lock.yml sources and README.md. Some tasks legitimately need that access (the label rename is a good example). gh-aw's protected-files.policy field accepts a GitHub Actions expression string, so instead of hardcoding a literal we key it off a label: agent/workflow-edits-allowed on the issue -> drafter.md may write protected files for that run; on the PR -> fix.md may too. The label has to be present on the triggering issue/PR before the event fires, so it's a human's decision made ahead of time, not something the agent can grant itself mid-run: neither workflow's safe-outputs expose add-labels, and both hold issues:read/ pull-requests:read rather than write. Absent the label, the expression falls back to request_review, so this changes nothing for ordinary agent-code runs. Assisted-by: https://github.com/cgwalters/cgwalters#llms
cgwalters
added a commit
that referenced
this pull request
Jul 30, 2026
The && ternary idiom (cond && 'allowed' || 'request_review') broke drafter.lock.yml and fix.lock.yml outright: gh-aw's compiler JSON-encodes this policy string with Go's default HTML-escaping, turning the literal && into \u0026\u0026 inside the heredoc-embedded config blob. GitHub Actions' expression parser can't parse that, so the whole workflow file was rejected as invalid on push -- see https://github.com/cgwalters/gh-aw-fullsend-mini/actions/runs/30547055376 (zero jobs even attempted; both drafter.md and fix.md were effectively disabled since the merge of #20). Switch to GitHub Actions' case() function, which expresses the same if/else without &, <, or > -- the only characters Go's json.Marshal HTML-escapes by default -- so it survives gh-aw's config serialization intact. Assisted-by: https://github.com/cgwalters/cgwalters#llms
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.
Follow-up from #19: the label-standardization drafter run got stuck at
request_reviewbecause renaming labels necessarily touchesREADME.mdand the.md/.lock.ymlworkflow sources, which are allprotected files.
drafter.mdandfix.mdnow key theirprotected-files.policyoffthe
agent/workflow-edits-allowedlabel (a supported gh-aw GitHubActions expression string), instead of hardcoding
request_review:drafter.mdruns -> that run maywrite protected files without the review gate.
fix.mdgets the same treatmentfor follow-up commits.
Absent the label, both fall back to
request_reviewexactly asbefore, so this changes nothing for ordinary
agent-coderuns. Thelabel has to already be on the issue/PR when the triggering event
fires — neither workflow's safe-outputs expose
add-labels, and bothhold read-only
issues/pull-requestspermissions — so an agentcan't grant itself this mid-run.
See "Letting the agent edit protected files" in README.md for the
full writeup.
The
agent/workflow-edits-allowedlabel has already been created onthe repo.