name: Shared - Commit Lint
on: workflow_call: inputs: runner: description: 'Runner type' required: false type: string default: 'ubuntu-latest'
jobs: commitlint: name: Lint Commit Messages runs-on: ${{ inputs.runner }} steps: - name: Checkout uses: actions/checkout@v5 with: fetch-depth: 0
- name: Install commitlint run: | npm install --save-dev @commitlint/config-conventional @commitlint/cli
- name: Validate PR commits if: github.event_name == 'pull_request' run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: Validate last commit if: github.event_name != 'pull_request' run: npx commitlint --from HEAD~1 --to HEAD --verbose Shared (cross-cutting)· Reusable workflow ·on: workflow_call
Shared Commit Lint
Shared - Commit Lint
.github/workflows/shared-commit-lint.yml