Support the pull request policy by using github actions.

pragmatic bash code to close pull requests from forks
pull/148/head
seebye 3 years ago
parent 31463ec815
commit 3780b8155e

@ -0,0 +1,20 @@
name: Pull request closer
on:
pull_request_target:
types: [opened,reopened]
jobs:
close-fork-pull-request:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: close pull request
run: |
pull_request_id='${{ github.event.pull_request.number }}'
echo closing pull request "${pull_request_id}" in repository "${GITHUB_REPOSITORY}"
curl \
--request PATCH \
--header "Accept: application/vnd.github.v3+json" \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${pull_request_id}" \
--data '{"state":"closed"}'
Loading…
Cancel
Save