Skip to content

Update close-pull-requests.yml #3

Update close-pull-requests.yml

Update close-pull-requests.yml #3

# Given the amount of PRs that this repository receives, this workflow pre-emptively closes PRs unless the `pre-approved` label is set.
name: Auto close pull requests
on:
pull_request:
types: [opened, labeled, unlabeled]
jobs:
auto_close:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Close PR if not pre-approved
if: ${{ !contains(github.event.pull_request.labels.*.name, 'pre-approved') }}
run: |
MESSAGE="This repository doesn't accept pull requests. Please fork the repository and make changes there. If you really need this PR to be merged you must be an admin and label this pr with the 'pre-approved' label."
gh pr close ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --comment "$MESSAGE"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}