Skip to content

Commit fd7c864

Browse files
chore(ci): enforce conventional commits PR title (#1564)
1 parent 7fc3f10 commit fd7c864

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

.github/workflows/lints.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Lint
1616
runs-on:
1717
- runs-on=${{ github.run_id }}
18-
- runner=8cpu-linux-x64
18+
- runner=64cpu-linux-x64
1919
- extras=s3-cache
2020
steps:
2121
- uses: runs-on/action@v1

.github/workflows/pr-title.yml

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

0 commit comments

Comments
 (0)