chore: add workflow to close prs from org accounts (and same branch prs)

This commit is contained in:
mworzala 2024-02-29 10:05:20 -05:00
parent 845113b6a9
commit 60fc9ebd28
No known key found for this signature in database
GPG Key ID: B148F922E64797C7
1 changed files with 28 additions and 0 deletions

28
.github/workflows/close_invalid_prs.yml vendored Normal file
View File

@ -0,0 +1,28 @@
# Thanks paper: https://github.com/lynxplay/paper/blob/master/.github/workflows/close_invalid_prs.yml
name: Close invalid PRs
on:
pull_request_target:
types: [ opened ]
jobs:
run:
if: |
github.repository != github.event.pull_request.head.repo.full_name &&
(
github.head_ref == 'master' ||
github.event.pull_request.head.repo.owner.type != 'User'
)
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
id: "master_branch"
if: github.head_ref == 'master'
with:
comment: "Please do not open pull requests from the `master` branch, create a new branch instead."
- uses: superbrothers/close-pull-request@v3
id: "org_account"
if: github.event.pull_request.head.repo.owner.type != 'User' && steps.master_branch.outcome == 'skipped'
with:
comment: "Please do not open pull requests from non-user accounts like organisations. Create a fork on a user account instead."