-
Hi, team. When I run "gh edit pr --add-label" using the GitHub application token, I got an error message saying I need project permissions. The code to reproduce this situation is as follows. Reproduction methodGitHub ApplicationGitHub application has permissions...
GitHub Actions : <snip>
jobs:
add-label:
runs-on: ubuntu-latest
steps:
- name: Generate github token
id: generate_token
uses: tibdex/github-app-token@v1
with:
# secrets.APP_ID and secrets.PRIVATE_KEY are set to the ID and private key of the GitHub application.
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
# env.PR_URL is set to the URL of pull request
- run: gh pr edit --add-label "label1" ${{ env.PR_URL }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} Error messages
SolutionI added project read permissions as the message suggested, and was able to edit the pull request and add labels. QuestionHowever, GitHub REST API v3 only says that editing a pull request requires write permission to the pull request. Why does "gh pr edit --add-label" require read permission to the project? By the way, in the public repository, "gh pr edit --add-label" does not require project read permission. Thank you very much. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hi, we currently load too much information about a PR prior to editing, including its project cards (if any). This is not necessary for the edit operation of adding labels, and will be addressed in a future release: #4876 The temporary fix is to allow |
Beta Was this translation helpful? Give feedback.
-
I'm still seeing this error about the token not having the |
Beta Was this translation helpful? Give feedback.
-
Hi, I get the following error: Resource not accessible by personal access token (repository.pullRequest.projectCards.nodes) After looking at this tread I realise that: repository-projects:read cannot be enable for personal accounts as the setting only appear when part of an organisation. So in the current state, if you are a looking for using a github action on your personnal account with a PAT, you must create a fake organisation :( Do you think the original PR could be "resurrected"? I see it's still in DRAFT. Regards. |
Beta Was this translation helpful? Give feedback.
-
Related issue: #9166 (comment) |
Beta Was this translation helpful? Give feedback.
Hi, we currently load too much information about a PR prior to editing, including its project cards (if any). This is not necessary for the edit operation of adding labels, and will be addressed in a future release: #4876
The temporary fix is to allow
repository-projects:read
access to the token doing the editing.