ci(auto-merge): grant issues:write and merge before commenting#69
Merged
Conversation
PR #68 (from a fork) passed lint but failed to auto-merge because `gh pr comment` was denied: GraphQL: Resource not accessible by integration (addComment) The repo's default workflow token is read-only, and this workflow declared `pull-requests: write` but not `issues: write`. `gh pr comment` uses the GraphQL `addComment` mutation, which is enforced under the `issues` scope (PR comments are stored as issue comments). With `set -euo pipefail`, the failed comment aborted the step before `gh pr merge` ever ran. Fixes: - Add `issues: write` so the comment calls work on fork PRs. - Run `gh pr merge` *before* the celebratory comment, so a future comment-permission regression cannot block a clean merge. - Make the celebratory comment best-effort (`|| true`). Verification: once on main, the workflow re-runs against the base-branch version on the next `synchronize`. Closing and reopening PR #68 will retrigger it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
✅ PR template check passed. Thanks for filling out the template. |
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.
Summary
Auto-merge of #68 (a fork PR) failed because the workflow's
gh pr commentwas denied (GraphQL: Resource not accessible by integration (addComment)). The workflow declaredpull-requests: writebut notissues: write, andgh pr commentposts via the GraphQLaddCommentmutation, which is enforced under theissuesscope.set -euo pipefailthen aborted the step beforegh pr mergeran. This grantsissues: write, reorders the step so merge runs before the celebratory comment, and makes that comment best-effort.Linked issue / ADR
No issue — surfaced by the failed run on PR #68. No ADR: this is workflow plumbing, not an architectural change.
Working agreement
bin/rubocopandbin/rspecpass locally — N/A, workflow-only change with no Ruby diffTest plan
End-to-end: once this lands on
main, thepull_request_targetworkflow re-runs against the base-branch version on the nextsynchronizeevent, so the fix applies retroactively to PR #68. Plan:validate-and-merge.✓ 2 entries, all validwas already green), thengh pr merge --squash --delete-branchsucceeds, then the "🎉 Thanks…" comment posts.|| truekeeps the merge effective — check the run log for permission drift.Notes for reviewer
default_workflow_permissionsfromreadtowrite, but per-workflow declarations are the more conservative path and match the rest of the repo.issues: writepermission also benefits theif: failure()"validation failure" comment step in this workflow, which would have hit the same denial.🤖 Generated with Claude Code