-
Notifications
You must be signed in to change notification settings - Fork 44
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
ci: add job to check PR label requirements #1189
Changes from 1 commit
9111665
ea8769a
003cbce
f10cf24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Check labels | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' # Trigger on all branches for pull requests | ||
types: [opened, synchronize, reopened, labeled, unlabeled] | ||
|
||
jobs: | ||
require-challenge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: mheap/github-action-required-labels@5847eef68201219cf0a4643ea7be61e77837bbce # v5.4.1 | ||
with: | ||
mode: exactly | ||
count: 1 | ||
labels: "challenged" | ||
add_comment: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The GitHub Actions token won't have write access if the PR is from a fork, do you know if the action handles that gracefully? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just like that. PR from forks don't get write permissions. You can configure it to allow it, but only for private repos. For public repositories there would only be the way to pass in a separate token that has the required permission (but here you have the same problem because fork PRs don't have access to secrets). So it might be easiest to just not create a comment (if the action does not handle it gracefully). The error you see right now on this PR though probably stems from trying to add a new workflow from a fork PR, which is also not allowed (I think it would usually run the version it finds in the base branch, but that does not exist). So to properly run on this PR, you would need to create the PR from a fork. |
||
message: "This PR cannot be merged yet because a required label is missing: `{{ provided }}`. It needs to be added before this PR can be merged." |
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.
Should this be
master
?I guess in practice it does not make a difference.
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.
Changed it to
master