Skip to content

Commit 4f0cbd2

Browse files
committed
ci: remove node dependency from commit validation
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 1550ee1 commit 4f0cbd2

3 files changed

Lines changed: 20 additions & 16 deletions

File tree

.github/workflows/commitlint.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,23 @@ jobs:
1010
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
13-
- uses: actions/setup-node@v4
14-
with:
15-
node-version: 20
16-
- run: npm ci
17-
- run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.sha }}
13+
- name: Validate Conventional Commits
14+
run: |
15+
set -euo pipefail
16+
RANGE="${{ github.event.pull_request.base.sha }}..${{ github.sha }}"
17+
18+
invalid=0
19+
while IFS= read -r message; do
20+
[[ -z "$message" ]] && continue
21+
22+
if [[ "$message" =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9._/-]+\))?!?:\ .+ ]]; then
23+
continue
24+
fi
25+
26+
echo "Invalid conventional commit message: $message"
27+
invalid=1
28+
done < <(git log --format=%s "$RANGE")
29+
30+
if [[ $invalid -ne 0 ]]; then
31+
exit 1
32+
fi

commitlint.config.cjs

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)