-
Notifications
You must be signed in to change notification settings - Fork 517
27 lines (24 loc) · 1.17 KB
/
close-pull-requests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name: Auto close pull requests
on:
pull_request_target:
types: [opened, labeled, unlabeled, reopened]
jobs:
auto_close:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Debug contains
echo: "The body of the pull request contains alfredodeza: ${{ contains(github.event.pull_request.body, 'alfredodeza') }} , and contains @alfredodeza: ${{ contains(github.event.pull_request.body, '@alfredodeza') }}"
- name: Close PR if not pre-approved
if: |
${{ !(
contains(github.event.pull_request.labels.*.name, 'pre-approved')
||
contains(github.event.pull_request.body, 'alfredodeza')
) }}
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 *or* tag Alfredo Deza (alfredodeza) to take a look."
gh pr close ${{ github.event.pull_request.number }} --repo education/codespaces-project-template-js --comment "$MESSAGE"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}