-
Notifications
You must be signed in to change notification settings - Fork 368
68 lines (59 loc) · 1.73 KB
/
Copy pathpr-template.yml
File metadata and controls
68 lines (59 loc) · 1.73 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: PR Template
on:
pull_request:
branches:
- main
- dev
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pr-template:
name: PR Template
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Check PR body
env:
PR_BODY: ${{ github.event.pull_request.body }}
shell: bash
run: |
set -euo pipefail
body="${PR_BODY:-}"
body="${body//$'\r'/}"
required_headers=(
"## Summary"
"## Scope"
"## Changes"
"## User Impact"
"## Compatibility / Runtime Notes"
"## Data / Security Notes"
"## Risk / Rollback"
"## Verification"
"## Screenshots / Recordings"
"## Docs"
"## Related"
)
missing_headers=()
for header in "${required_headers[@]}"; do
if ! grep -Fq "$header" <<< "$body"; then
missing_headers+=("$header")
fi
done
if (( ${#missing_headers[@]} > 0 )); then
echo "PR body is missing required template sections:"
printf ' - %s\n' "${missing_headers[@]}"
exit 1
fi
if ! grep -Eq '^- \[[xX]\] (Frontend panel|Manager Server|CPA panel mode|Full Docker mode|Native packages / release|Docs / Wiki|CI / build / tooling)$' <<< "$body"; then
echo "PR body must check at least one item in the Scope section."
exit 1
fi