-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.29 KB
/
Copy pathpull-request.yml
File metadata and controls
39 lines (35 loc) · 1.29 KB
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
name: Pull request
# Not in ci.yml: `edited` there would re-run the integration lane on every body edit.
on:
pull_request:
types: [opened, edited, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
# Headings come from the template itself, so the two cannot drift. The job name
# is load-bearing: main's branch protection requires `pull-request-body`.
pull-request-body:
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check the pull request body against the template
env:
BODY: ${{ github.event.pull_request.body }}
run: |
missing=""
while IFS= read -r heading; do
printf '%s\n' "$BODY" | grep -qF "$heading" || missing="${missing}\n ${heading}"
done < <(grep '^## ' .github/pull_request_template.md)
if [ -n "$missing" ]; then
printf 'pull request body is missing:%b\n' "$missing" >&2
echo "Keep the template's sections; delete the comments, not the headings." >&2
exit 1
fi