-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
417c2c7
commit 6e2f409
Showing
1 changed file
with
0 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
name: Commitlint | ||
|
||
on: | ||
push: | ||
branches-ignore: ["main"] # 排除 main 分支的 push 事件 | ||
pull_request: | ||
branches-ignore: ["main"] # 排除 main 分支的 pull request 事件 | ||
workflow_dispatch: | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
- run: npm install -g @commitlint/cli @commitlint/config-conventional | ||
- run: | | ||
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js | ||
- name: Check commits | ||
run: | | ||
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then | ||
commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | ||
else | ||
commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose | ||
fi |