-
Notifications
You must be signed in to change notification settings - Fork 8.2k
gh pr edit --add-label to PR requires write permission to both issues and pull-requests #4631
Description
Not sure if this is the best place to post this issue, it may also be a lack of documentation for the GitHub API or CLI.
Describe the bug
gh pr edit --add-label to PR requires write permission to both issues and pull-requests.
-
Expected failure without any write permission:
https://github.com/curl/curl/runs/4021004943?check_suite_focus=true#step:5:13 -
Unexpected silent failure with write permission to pull-requests, but missing write permission to issues:
https://github.com/curl/curl/runs/4021113193?check_suite_focus=true#step:5:17
(mentioned PRs did not get the label via GitHub Actions bot, but it was then later manually added by myself) -
Surprising success with both write permissions for pull-requests and issues:
https://github.com/curl/curl/runs/4027534500?check_suite_focus=true#step:5:13
(mentioned PR did get the label via GitHub Actions bot)
Local version affected in addition to the version inside the ubuntu-latest GitHub Action image:
gh version 2.2.0 (2021-10-25)
https://github.com/cli/cli/releases/tag/v2.2.0
Steps to reproduce the behavior
Repeat the following steps with the different set of workflow permissions mentioned above:
- Add
hacktoberfestlabel to a test repository (can also replacehacktoberfestwithhacktobertestor some other test label to avoid actual participation). - Copy this workflow into the test repository (adapt workflow to test label for both the repository and pull-requests if changed in previous step).
- Make sure the workflow is present on the default branch on GitHub (adapt workflow to run on pushes to default branch if needed).
- Open a new pull-request to the test repository.
- Mention the pull-request with a "Closes #prnum" reference on the default branch.
Expected vs actual behavior
I would have expected this to work with just the write permission for pull-requests since a PR is the target of the edit.
Logs
See links to check logs mentioned above.