Skip to content

Commit 8653a47

Browse files
kevaundrayRjected
andauthored
chore: Add pull request title lint (paradigmxyz#15357)
Co-authored-by: Dan Cline <[email protected]>
1 parent c3471bf commit 8653a47

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/pr-title.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
permissions:
12+
pull-requests: read
13+
contents: read
14+
15+
jobs:
16+
conventional-title:
17+
name: Validate PR title is Conventional Commit
18+
runs-on: ubuntu-latest
19+
permissions:
20+
pull-requests: write
21+
steps:
22+
- name: Check title
23+
id: lint_pr_title
24+
uses: amannn/action-semantic-pull-request@v5
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
with:
28+
types: |
29+
fix
30+
feat
31+
chore
32+
test
33+
perf
34+
refactor
35+
docs
36+
ci
37+
continue-on-error: true
38+
- name: Add PR Comment for Invalid Title
39+
if: steps.lint_pr_title.outcome == 'failure'
40+
uses: marocchino/sticky-pull-request-comment@v2
41+
with:
42+
header: pr-title-lint-error
43+
message: |
44+
Your PR title doesn't follow the Conventional Commit guidelines.
45+
46+
**Example of valid titles:**
47+
- `feat: add new user login`
48+
- `fix: correct button size`
49+
- `docs: update README`
50+
51+
**Usage:**
52+
- `feat`: Introduces a new feature
53+
- `fix`: Patches a bug
54+
- `chore`: General maintenance tasks or updates
55+
- `test`: Adding new tests or modifying existing tests
56+
- `perf`: Performance improvements
57+
- `refactor`: Changes to improve code structure
58+
- `docs`: Documentation updates
59+
- `ci`: Changes to CI/CD configurations
60+
61+
**Breaking Changes**
62+
63+
Breaking changes are noted by using an exclamation mark. For example:
64+
- `feat!: changed the API`
65+
- `chore(node)!: Removed unused public function`
66+
67+
**Help**
68+
69+
For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/
70+
71+
- name: Remove Comment for Valid Title
72+
if: steps.lint_pr_title.outcome == 'success'
73+
uses: marocchino/sticky-pull-request-comment@v2
74+
with:
75+
header: pr-title-lint-error
76+
delete: true
77+
78+
- name: Fail workflow if title invalid
79+
if: steps.lint_pr_title.outcome == 'failure'
80+
run: exit 1

0 commit comments

Comments
 (0)