-
Notifications
You must be signed in to change notification settings - Fork 2.1k
57 lines (48 loc) · 2.15 KB
/
pr-validation.yaml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: PR validity
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check_testing_header:
runs-on: ubuntu-latest
steps:
- name: Check for Testing Header
id: check-testing
continue-on-error: true
run: |
python -c 'import sys; pr_summary = """${{ github.event.pull_request.body }}"""; sys.exit(0 if "### Testing" in pr_summary else 1)'
- name: Check for Instructions Deletion
id: check-instructions
continue-on-error: true
run: |
python -c 'import sys; pr_summary = """${{ github.event.pull_request.body }}"""; sys.exit(1 if "Make sure you delete these instructions" in pr_summary else 0)'
- name: Add comment (missing instructions)
if: steps.check-instructions.outcome == 'failure'
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 make sure to delete starter instructions from your PR summary and replace them with a descriptive summary.'
})
- name: Fail if instructions check failed
if: steps.check-testing.outcome == 'failure'
run: |
python -c 'import sys; print("PR instructions were not replaced"); sys.exit(1)'
- name: Add comment (missing testing)
if: steps.check-testing.outcome == 'failure'
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 add a `### Testing` section to your PR summary describing the testing performed. See https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#pull-requests'
})
- name: Fail if testing section check failed
if: steps.check-testing.outcome == 'failure'
run: |
python -c 'import sys; print("Testing section missing (test failed)"); sys.exit(1)'