Skip to content
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

Closed

Conversation

florianesser
Copy link
Member

Add a check to verify that a PR has the challenged label. Would need to be added to the "required checks" in the repository. Functionality can be tested with this PR in my fork.

Copy link
Member

@stempler stempler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a check to verify that a PR has the challenged label.

Please add require-challenge to the required checks in the .wetf-repo.yml file.

on:
pull_request:
branches:
- '*' # Trigger on all branches for pull requests
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to master

mode: exactly
count: 1
labels: "challenged"
add_comment: true
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a permissions section now but it looks as if the workflow still doesn't have the necessary permissions to add a comment to the PR. Looks like the same problem that you had here. Any suggestions welcome.

Copy link
Member

@stempler stempler May 28, 2024

Choose a reason for hiding this comment

The 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.

@florianesser florianesser added the challenged For PRs to indicate that the implementation has been challenged label May 28, 2024
@florianesser
Copy link
Member Author

Closed in favour of #1190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenged For PRs to indicate that the implementation has been challenged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants