chore(repo): enforce conventional commits

This commit is contained in:
xixu-me committed 2026-03-06 19:13:59 +08:00
1 parent 60d4db8780
commit 09c50c136f
6 files changed
+1129 -1

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
name: Commit Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
commitlint:
name: Validate Commit Messages
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint commit messages
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
FROM="${{ github.event.pull_request.base.sha }}"
TO="${{ github.event.pull_request.head.sha }}"
else
FROM="${{ github.event.before }}"
TO="${{ github.sha }}"
fi
if [[ "$FROM" == "0000000000000000000000000000000000000000" ]]; then
npx commitlint --last --verbose
else
npx commitlint --from "$FROM" --to "$TO" --verbose
fi