Skip to content

refactor: CI workflows and improve commit-lint setup #27

refactor: CI workflows and improve commit-lint setup

refactor: CI workflows and improve commit-lint setup #27

Workflow file for this run

name: Commit Lint
on:
pull_request:
branches: [main, master]
workflow_call:
workflow_dispatch:
jobs:
commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: "0"
- name: Create commit-lint configuration
run: |
cat > "${RUNNER_TEMP}/commitlintrc" <<'EOF'
{
"rules": {
"header-case": [2, "always", ["sentence-case", "start-case", "pascal-case", "lower-case"]],
"header-max-length": [2, "always", 80],
"subject-case": [2, "always", ["lower-case", "sentence-case", "start-case"]],
"type-case": [2, "always", ["lower-case"]],
"type-empty": [2, "never"],
"type-enum": [2, "always", ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"]]
}
}
EOF
- name: Validate commits with commitlint
env:
COMMITLINT_ARGS: ${{ github.event.pull_request && format('--from={0} --to={1}', github.event.pull_request.base.sha, github.event.pull_request.head.sha) || '--last' }}
run: |
npx --yes commitlint@19 \
--config="${RUNNER_TEMP}/commitlintrc" \
${COMMITLINT_ARGS} \
--verbose