Fix push-to-pull-request-branch requesting unnecessary issues:write permission#16342
Fix push-to-pull-request-branch requesting unnecessary issues:write permission#16342
Conversation
…ll-requests:write Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot format and recompile |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Formatted code and recompiled all workflows. The recompilation updated 5 workflow lock files to remove Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where the push-to-pull-request-branch safe output unconditionally requested issues: write permission even though it only pushes commits to PR branches and doesn't create or modify issues.
Changes:
- Updated permission requirements for
push-to-pull-request-branchto only requestcontents: writeandpull-requests: write - Added comprehensive test coverage to verify the correct permissions
- Recompiled affected workflow lock files to remove unnecessary
issues: writepermission
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/safe_outputs_permissions.go | Changed push-to-pull-request-branch to use NewPermissionsContentsWritePRWrite() instead of NewPermissionsContentsWriteIssuesWritePRWrite() |
| pkg/workflow/push_to_pull_request_branch_test.go | Updated test to verify that issues: write should NOT be present in generated workflow |
| pkg/workflow/safe_outputs_permissions_test.go | Added explicit test case verifying push-to-pull-request-branch only requires contents and pull-requests write permissions |
| .github/workflows/changeset.lock.yml | Recompiled workflow - removed issues: write from safe_outputs and conclusion jobs |
| .github/workflows/mergefest.lock.yml | Recompiled workflow - removed issues: write from safe_outputs and conclusion jobs |
| .github/workflows/contribution-check.lock.yml | Recompiled workflow - includes unrelated side effect from recompilation (additional env vars for pre_activation outputs) |
| .github/workflows/issue-monster.lock.yml | Recompiled workflow - includes unrelated side effect from recompilation (assign_to_agent tool description update for pull_request_repo parameter) |
| .github/workflows/workflow-generator.lock.yml | Recompiled workflow - includes unrelated side effect from recompilation (assign_to_agent tool description update for pull_request_repo parameter) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Plan: Fix push-to-pull-request-branch unconditionally requesting issues:write
safe_outputs_permissions.gocreate-pull-requesthandlesfallback-as-issuesettingcomputePermissionsForSafeOutputsto useNewPermissionsContentsWritePRWrite()forpush-to-pull-request-branchissues: writefrom push-to-pull-request-branch permissionspush_to_pull_request_branch_test.goto verify correct permissions (remove issues:write check)safe_outputs_permissions_test.gofor push-to-pull-request-branchSummary
Fixed
push-to-pull-request-branchsafe output to only requestcontents: writeandpull-requests: writepermissions instead of unconditionally requestingissues: write.Changes Made:
pkg/workflow/safe_outputs_permissions.go: Changedpush-to-pull-request-branchto useNewPermissionsContentsWritePRWrite()instead ofNewPermissionsContentsWriteIssuesWritePRWrite()pkg/workflow/push_to_pull_request_branch_test.go: Updated test to verify thatissues: writeshould NOT be presentpkg/workflow/safe_outputs_permissions_test.go: Added test case explicitly verifyingpush-to-pull-request-branchonly requirescontents: writeandpull-requests: writepush-to-pull-request-branchto removeissues: writepermissionVerification:
issues: write)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.