Fix add-comment and hide-comment to use issues:write instead of pull_requests:write#16687
Fix add-comment and hide-comment to use issues:write instead of pull_requests:write#16687
Conversation
…ead of pull_requests:write Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a permissions issue where add-comment and hide-comment safe outputs incorrectly requested pull_requests: write permission. Since PR comments are issue comments in GitHub's API, only issues: write is required.
Changes:
- Updated permission computation for
add-commentandhide-commentto useissues: writeinstead ofpull_requests: writewhendiscussions: false - Added explanatory comments clarifying that PR comments are issue comments
- Updated test expectations to reflect the corrected permission requirements
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/workflow/safe_outputs_permissions.go | Fixed permission computation for both add-comment and hide-comment to use NewPermissionsContentsReadIssuesWrite() when discussions are disabled |
| pkg/workflow/add_comment.go | Updated add-comment job builder to use correct permissions helper function |
| pkg/workflow/safe_outputs_permissions_test.go | Removed PermissionPullRequests: PermissionWrite from test expectations for add-comment and hide-comment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot fix test failures in https://github.com/github/gh-aw/actions/runs/22163965834/job/64087057491 |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in commit 33201fe. Updated |
|
@copilot:claude-sonnet-4.5 fix tests in https://github.com/github/gh-aw/actions/runs/22164300562/job/64088091764?pr=16687 |
|
@pelikhan The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
|
@copilot:claude-sonnet-4.5 fix tests in https://github.com/github/gh-aw/actions/runs/22164300562/job/64088091764?pr=16687 |
|
@pelikhan The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
…ctation for add-comment Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in commit d1d759c. Updated |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
🧪 Smoke Project is now testing project operations... |
|
🧪 Smoke Temporary ID is now testing temporary ID functionality... |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
✅ Smoke Project completed successfully. All project operations validated. |
|
Smoke test results:
|
|
Smoke test results for
Overall: PASS
|
There was a problem hiding this comment.
This PR correctly removes pull-requests: write from add-comment and hide-comment safe-output jobs. These operations only need issues: write — good least-privilege fix applied consistently across all affected workflow files.
📰 BREAKING: Report filed by Smoke Copilot for issue #16687
| discussions: write | ||
| issues: write | ||
| pull-requests: write | ||
| outputs: |
There was a problem hiding this comment.
✅ Good fix — add_comment and hide_comment operations only require issues:write, not pull_requests:write. Removing the overly-broad permission follows the principle of least privilege.
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Smoke Test Results - Run §22164908321Core Tests: ✅ #1 GitHub MCP | ✅ #2 GH CLI | ✅ #3 Serena | ✅ #4 Make Build | ✅ #5 Playwright | ✅ #6 Tavily | ✅ #7 File Write | ✅ #8 Bash | ✅ #9 Discussion | ✅ #10 Agentic Workflows PR Review Tests: ✅ #11 Update PR | ✅ #12 Review Comments | ✅ #13 Submit Review | ✅ #14 Resolve Thread | ✅ #15 Add Reviewer | ❌ #16 Push to Branch (git identity not configured) | Overall: PARTIAL
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude for issue #16687
Fix add-comment and hide-comment permissions
Issue
The
add-commentandhide-commentsafe outputs incorrectly requiredpull_requests: writepermission when they only needissues: write. PR comments are actually issue comments under the hood in GitHub's API.Changes Made
add_comment.go- UseNewPermissionsContentsReadIssuesWrite()when discussions are disabledsafe_outputs_permissions.go- Applied same fix for bothadd-commentandhide-commentsafe_outputs_permissions_test.go- Removedpull_requests: writefrom expected permissionsnotify_comment_test.go- Removedpull-requests: writeexpectation for add-commentcompiler_safe_outputs_job_test.go- Removedpull-requests: writefrom add-comment and multiple safe output test casesOriginal prompt
pull_requests: write#16673🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.
Fix add-comment and hide-comment to use issues:write instead of pull_requests:write
Fix add-comment and hide-comment permissions
Issue
The
add-commentandhide-commentsafe outputs incorrectly requiredpull_requests: writepermission when they only needissues: write. PR comments are actually issue comments under the hood in GitHub's API.Changes Made
add_comment.go- UseNewPermissionsContentsReadIssuesWrite()when discussions are disabledsafe_outputs_permissions.go- Applied same fix for bothadd-commentandhide-commentsafe_outputs_permissions_test.go- Removedpull_requests: writefrom expected permissionsnotify_comment_test.go- Removedpull-requests: writeexpectation for add-commentcompiler_safe_outputs_job_test.go- Removedpull-requests: writefrom add-comment and multiple safe output test casesOriginal prompt
pull_requests: write#16673Changeset
✨ PR Review Safe Output Test - Run 22164908321