-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (58 loc) · 1.85 KB
/
Copy pathsemantic-pr-check.yml
File metadata and controls
62 lines (58 loc) · 1.85 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
# Semantic PR Title Validation
#
# This workflow validates PR titles follow conventional commit format.
name: Semantic PR Title Validation
on:
pull_request:
types: [opened, edited, ready_for_review, synchronize]
jobs:
validate-pr-title:
name: Validate PR Title
# Skip if 'edited' event but the title wasn't changed (e.g., only description was edited)
if: >
github.event.action != 'edited'
|| (
github.event.changes.title &&
github.event.changes.title.from != ''
)
runs-on: ubuntu-latest
steps:
- name: Check semantic PR title
uses: amannn/action-semantic-pull-request@v6
if: ${{ github.event.pull_request.draft == false }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed (newline-delimited).
# These are intentionally case-insensitive, allowing title casing or all lowercase.
# See: https://github.com/commitizen/conventional-commit-types/blob/master/index.json
types: |
fix
Fix
feat
Feat
docs
Docs
ci
CI
chore
Chore
build
Build
test
Test
refactor
Refactor
perf
Perf
style
Style
- name: Check for "do not merge" in PR title
if: ${{ github.event.pull_request.draft == false }}
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request.title.toLowerCase();
if (title.includes('do not merge') || title.includes('do-not-merge')) {
core.setFailed('PR title contains "do not merge" or "do-not-merge". Please remove this before merging.');
}