Skip to content

feat: 完成 pr-commit-lint 分支的任务 #31

feat: 完成 pr-commit-lint 分支的任务

feat: 完成 pr-commit-lint 分支的任务 #31

Workflow file for this run

name: Commitlint
on:
pull_request: # 只在 PR 事件时触发
workflow_dispatch: # 允许手动触发
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # 获取完整的历史记录
- name: Setup Node.js Environment
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Commitlint
run: npm install -g @commitlint/cli @commitlint/config-conventional
- name: Configure Commitlint
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
fi