2023-01-09 21:43:54 +00:00
|
|
|
name: Close invalid PRs
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request_target:
|
|
|
|
types: [ opened ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
run:
|
2024-02-28 14:18:58 +00:00
|
|
|
if: |
|
|
|
|
github.repository != github.event.pull_request.head.repo.full_name &&
|
|
|
|
(
|
|
|
|
github.head_ref == 'master' ||
|
|
|
|
github.event.pull_request.head.repo.owner.type != 'User'
|
|
|
|
)
|
2023-01-09 21:43:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: superbrothers/close-pull-request@v3
|
2024-02-28 14:18:58 +00:00
|
|
|
id: "master_branch"
|
|
|
|
if: github.head_ref == 'master'
|
2023-01-09 21:43:54 +00:00
|
|
|
with:
|
|
|
|
comment: "Please do not open pull requests from the `master` branch, create a new branch instead."
|
2024-02-28 14:18:58 +00:00
|
|
|
|
|
|
|
- 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 organizations. Create a fork on a user account instead."
|