Skip to content

Commit 019045b

Browse files
committed
ci: add new workflows to validate PR and commit format
1 parent fadded3 commit 019045b

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/lint-pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Lint PR"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
main:
16+
name: Validate PR title
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: amannn/action-semantic-pull-request@v5.5.3
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint commit
2+
3+
on: pull_request_target
4+
5+
jobs:
6+
commitlint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 'lts/*'
15+
cache: npm
16+
17+
- name: Install commitlint
18+
run: |
19+
npm install conventional-changelog-conventionalcommits
20+
npm install commitlint@latest
21+
22+
- name: Validate PR commits with commitlint
23+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)