Skip to content

Commit d5a095c

Browse files
feat(ci): add PR title validation to prevent invalid merge commits (#5304)
1 parent a54d62b commit d5a095c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666
- name: Commit linting
6767
if: github.ref != 'refs/heads/master'
6868
uses: wagoid/commitlint-github-action@v5
69+
with:
70+
configFile: commitlint.config.js
6971
- name: GolangCI-Lint
7072
uses: golangci/golangci-lint-action@v8
7173
with:

.github/workflows/pr-title.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PR Title Lint
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
lint-title:
9+
name: Lint PR Title
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Setup Node
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20'
18+
- name: Install commitlint
19+
run: npm install --save-dev @commitlint/cli @commitlint/config-conventional
20+
- name: PR title linting
21+
env:
22+
PR_TITLE: ${{ github.event.pull_request.title }}
23+
run: echo "$PR_TITLE" | npx commitlint --config ./commitlint.config.js

0 commit comments

Comments
 (0)