-
Notifications
You must be signed in to change notification settings - Fork 449
docs: Update document to include issues permission #867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Yeah, I ran into the same thing, but odd that you need issue permission to write to write labels to a PR. furthermore, I have two identical repositories, with seemingly identical workflows, but the latest repository fails, but the older one does not. All settings are checked, and all tokens are verified: works: https://github.com/phun-ky/typeof/actions/runs/14731948751 |
I have experienced the same thing, but even with the |
Any input from the author on this? |
This resolved the permission issues for me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity, the reason why issues: write
may be needed is for when the label does not exist.
For example, if you have no "testing" label and you run:
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <token>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/<owner>/<repository>/issues/<number>/labels \
-d '{"labels":["testing"]}'
Which is this from the documentation and this from the source code:
Lines 1 to 15 in b0a1180
import * as github from '@actions/github'; | |
import {ClientType} from './types'; | |
export const setLabels = async ( | |
client: ClientType, | |
prNumber: number, | |
labels: string[] | |
) => { | |
await client.rest.issues.setLabels({ | |
owner: github.context.repo.owner, | |
repo: github.context.repo.repo, | |
issue_number: prNumber, | |
labels: labels | |
}); | |
}; |
The label will be created and placed!
Those who are not experiencing problems are because they already have the labels in place. issues: write
is only needed if labels are not already present, which is why a seemingly unrelated error occurs:
HttpError: You do not have permission to create labels on this repository
Can you please ensure this is mentioned somewhere in the README.md? I do not see this is present.
Description:
Ran into this error, it seems that we have mission permission that's needed for the labeler to work.
Therefore, including the extra permission into the README.md so no one has to go through what I did. 😆
Related issue:
https://github.com/orgs/community/discussions/156181
Check list: