Repository navigation
ci: bump actions/checkout from 4.3.1 to 7.0.1 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Commit lint | |
| on: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| conventional-commits: | |
| name: Conventional Commits | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check commit subjects follow Conventional Commits | |
| env: | |
| BASE: ${{ github.event.pull_request.base.sha }} | |
| HEAD: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| types='build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test' | |
| pattern="^(${types})(\([a-z0-9._/-]+\))?!?: .+" | |
| fail=0 | |
| for sha in $(git rev-list --no-merges "$BASE..$HEAD"); do | |
| subject=$(git log -1 --format=%s "$sha") | |
| if printf '%s' "$subject" | grep -qE "$pattern"; then | |
| echo "ok: $subject" | |
| else | |
| echo "::error::Not a Conventional Commit: $subject" | |
| fail=1 | |
| fi | |
| done | |
| if [ "$fail" -ne 0 ]; then | |
| echo "Commit subjects must be Conventional Commits: type(scope): subject" | |
| echo "Allowed types: ${types//|/, }" | |
| exit 1 | |
| fi |