Skip to content

feat: add workflow_call #3

feat: add workflow_call

feat: add workflow_call #3

Workflow file for this run

name: Organization Commit Message Lint
on:
workflow_call:
push:
branches: [main]
pull_request:
types: [opened, synchronize, edited, reopened]
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 必须完整历史才能比较提交
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install commitlint
run: |
npm install --save-dev @commitlint/{config-conventional,cli}
- name: Run commitlint
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.sha }}
else
npx commitlint --from=HEAD~1 --to=HEAD
fi