Forbid develop branch fork contributions
This commit is contained in:
parent
add82aca8d
commit
9b6c8b0eff
1 changed files with 33 additions and 1 deletions
34
.github/workflows/pull_request.yml
vendored
34
.github/workflows/pull_request.yml
vendored
|
|
@ -1,7 +1,12 @@
|
||||||
name: Pull Request
|
name: Pull Request
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ opened, labeled, unlabeled ]
|
types: [ opened, edited, labeled, unlabeled, synchronize ]
|
||||||
|
workflow_call:
|
||||||
|
secrets:
|
||||||
|
ELEMENT_BOT_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prevent-blocked:
|
prevent-blocked:
|
||||||
name: Prevent blocked
|
name: Prevent blocked
|
||||||
|
|
@ -43,3 +48,30 @@ jobs:
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
labels: ['Z-Community-PR']
|
labels: ['Z-Community-PR']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
close-if-fork-develop:
|
||||||
|
name: Forbid develop branch fork contributions
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: >
|
||||||
|
github.event.action == 'opened' &&
|
||||||
|
github.event.pull_request.head.ref == 'develop' &&
|
||||||
|
github.event.pull_request.head.repo.full_name != github.repository
|
||||||
|
steps:
|
||||||
|
- name: Close pull request
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
github.rest.issues.createComment({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: "Thanks for opening this pull request, unfortunately we do not accept contributions from the main" +
|
||||||
|
" branch of your fork, please re-open once you switch to an alternative branch for everyone's sanity.",
|
||||||
|
});
|
||||||
|
|
||||||
|
github.rest.pulls.update({
|
||||||
|
pull_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
state: 'closed'
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue