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

github: automatically close PRs from the master branch. #4639

Merged

Conversation

OhmSpectator
Copy link
Member

@OhmSpectator OhmSpectator commented Feb 24, 2025

This GitHub Actions workflow detects pull requests originating from the master branch and automatically closes them. It also leaves a comment explaining the reason and guiding contributors to create a feature branch instead.

Closes: #4637

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM

@OhmSpectator
Copy link
Member Author

We have tested it in @rene's repo, and it fails with the permission error:

{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#update-a-pull-request",
  "status": "403"
}
{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment",
  "status": "403"
}

rene#41

@OhmSpectator OhmSpectator marked this pull request as draft February 25, 2025 09:27
@OhmSpectator OhmSpectator force-pushed the feature/decline-master-prs branch from 2465f1f to 774038b Compare February 25, 2025 09:33
@OhmSpectator OhmSpectator force-pushed the feature/decline-master-prs branch 3 times, most recently from bffdbb0 to 4096af2 Compare February 25, 2025 10:30
@uncleDecart
Copy link
Member

uncleDecart commented Feb 25, 2025

@rene needs to enable permisions for actions in his repository, should be somewhere in settings

edit: not sure what kind of power our GHAs have, they should be able to write to repo and close PRs..., but someone with admin access should check it

@OhmSpectator OhmSpectator force-pushed the feature/decline-master-prs branch 3 times, most recently from c08f1b1 to 0489fa0 Compare February 25, 2025 10:58
@OhmSpectator
Copy link
Member Author

Here is how it works

rene#52

This GitHub Actions workflow detects pull requests originating from the
`master` branch and automatically closes them. It also leaves a comment
explaining the reason and guiding contributors to create a feature
branch instead.

Signed-off-by: Nikolay Martyanov <[email protected]>
@OhmSpectator OhmSpectator force-pushed the feature/decline-master-prs branch from 0489fa0 to 237e259 Compare February 25, 2025 11:04
@OhmSpectator OhmSpectator marked this pull request as ready for review February 25, 2025 11:04
@OhmSpectator OhmSpectator merged commit 4265dde into lf-edge:master Feb 25, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle better PRs submitted from a contributor's master branch
5 participants