Skip to content

test: cli

test: cli #306

name: "PR Title: Conventional Commit Lint"
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
lint_pr_title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
# Install commitlint and the conventional config
# Ref: https://github.com/conventional-changelog/commitlint/blob/27dad55a69e7c531e2c57a3b1db7ead40fa3a304/%40commitlint/config-conventional/README.md?plain=1#L11-L12
- name: Install Commitlint
run: |
npm install --save-dev @commitlint/config-conventional @commitlint/cli
echo "export default {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
# Lint the PR title against Conventional Commits
# Ref: https://commitlint.js.org/reference/cli.html
- name: Lint PR title
run: |
echo "${{ github.event.pull_request.title }}" \
| npx commitlint --config commitlint.config.js