-
Notifications
You must be signed in to change notification settings - Fork 5.2k
36 lines (35 loc) · 1.33 KB
/
pr-validation.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
28
29
30
31
32
33
34
35
36
name: "PR Tasks Completed Check"
on:
pull_request:
types: opened
jobs:
task-check:
# Only run from the base repository
if: github.event.repository.name == 'emilybache/GildedRose-Refactoring-Kata'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Comment if checkmark is missing
if: ${{ !contains(github.event.pull_request.body, '[X] I acknowledge') }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Please don't submit a Pull Request containing a Kata solution to the original repo from Emily Bache. If you are instead trying to add an improvement, please resubmit this PR and check the `[X]` box in the PR template."
})
- name: Close PR if checkmark is missing
if: ${{ !contains(github.event.pull_request.body, '[X] I acknowledge') }}
uses: actions/github-script@v6
with:
script: |
github.rest.pulls.update({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed'
})