updata commitlint.yml #7
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
name: Commitlint | |
on: | |
push: | |
# 仅当推送分支不是main时运行工作流 | |
branches-ignore: ["main"] | |
pull_request: | |
branches: ["main"] | |
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 | |
# 修改commitlint检查范围,只检查当前分支的最近提交,修改--from,使其从两个分支的共同祖先开始检查而不是最开始的提交 | |
- run: commitlint --from $(git merge-base origin/main HEAD) --to HEAD --verbose | |