Skip to content

Commit bd57e74

Browse files
committed
chore: add pr and commit lint
1 parent 65c608a commit bd57e74

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/configs/commitlint.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
extends: ['@commitlint/config-conventional'],
3+
};

.github/workflows/commitlint.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint Commit Messages
2+
3+
on: [pull_request]
4+
5+
permissions:
6+
contents: read
7+
pull-requests: read
8+
9+
jobs:
10+
commitlint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: wagoid/commitlint-github-action@v6
15+
with:
16+
configFile: .github/configs/commitlint.config.mjs

.github/workflows/pr_name.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: pr-name-linter
2+
3+
on:
4+
pull_request:
5+
types: ['opened', 'edited', 'reopened', 'synchronize']
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install Dependencies
14+
run: |
15+
npm install @commitlint/config-conventional
16+
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
17+
18+
- name: Lint the PR Title
19+
run: |
20+
echo "${PR_TITLE}" | npx --yes commitlint
21+
env:
22+
PR_TITLE: '${{ github.event.pull_request.title }}'

0 commit comments

Comments
 (0)