Repository navigation
70 lines (66 loc) · 2.4 KB
/
Copy pathpr-checks.yml
File metadata and controls
70 lines (66 loc) · 2.4 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
69
70
name: PR Checks
on:
pull_request:
types: [opened, edited, synchronize, reopened]
branches: [develop, main]
jobs:
branch-naming:
name: Branch Naming
runs-on: ubuntu-latest
steps:
- name: Check branch name
env:
HEAD_REF: ${{ github.head_ref }}
run: |
echo "Checking branch: $HEAD_REF"
ALLOWED="^(feat|fix|docs|chore|perf|security|refactor|test|build|ci)/"
if echo "$HEAD_REF" | grep -qE "$ALLOWED"; then
echo "OK: branch name follows convention"
else
echo "::error::Branch name must start with one of: feat/, fix/, docs/, chore/, perf/, security/, refactor/, test/, build/, ci/"
echo "Example: fix/ingest-envelope, feat/web-filters"
echo "Current: $HEAD_REF"
exit 1
fi
pr-template:
name: PR Description
runs-on: ubuntu-latest
steps:
- name: Check PR body
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
echo "Checking PR description..."
MISSING=""
if ! echo "$PR_BODY" | grep -qi "## What"; then
MISSING="$MISSING\n - ## What (description of the change)"
fi
if ! echo "$PR_BODY" | grep -qi "## Why"; then
MISSING="$MISSING\n - ## Why (the problem you're solving)"
fi
if ! echo "$PR_BODY" | grep -qi "## Testing"; then
MISSING="$MISSING\n - ## Testing (how you verified this works)"
fi
if [ -n "$MISSING" ]; then
echo "::error::PR description is missing required sections:$MISSING"
exit 1
fi
echo "OK: PR description has required sections"
commit-conventional:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- name: Check PR title format
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "Checking PR title: $PR_TITLE"
PATTERN="^(feat|fix|docs|chore|perf|refactor|test|build|ci|security)(\(.+\))?!?: .+"
if echo "$PR_TITLE" | grep -qE "$PATTERN"; then
echo "OK: PR title follows Conventional Commits"
else
echo "::error::PR title must follow Conventional Commits format"
echo "Expected: type(scope): short description"
echo "Example: fix(ingest): handle empty envelope"
exit 1
fi