build: replace lefthook with husky, commitlint and commit-and-tag-version
This commit is contained in:
parent
fa913d1561
commit
92ed47ebdf
11 changed files with 3607 additions and 73 deletions
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
|
|
@ -19,29 +19,15 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Validate conventional commits
|
||||
run: |
|
||||
base="${{ github.event.pull_request.base.sha }}"
|
||||
head="${{ github.event.pull_request.head.sha }}"
|
||||
pattern='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?(!)?: .{1,}$'
|
||||
|
||||
failed=0
|
||||
while IFS= read -r msg; do
|
||||
first_line=$(echo "$msg" | head -1)
|
||||
if ! echo "$first_line" | grep -qE "$pattern"; then
|
||||
echo "FAIL: $first_line"
|
||||
failed=1
|
||||
fi
|
||||
done < <(git log --format="%s" "$base".."$head")
|
||||
|
||||
if [ "$failed" -eq 1 ]; then
|
||||
echo ""
|
||||
echo "Some commits do not follow Conventional Commits format."
|
||||
echo "Expected: <type>[scope][!]: <description>"
|
||||
echo "See: https://www.conventionalcommits.org/"
|
||||
exit 1
|
||||
fi
|
||||
echo "All commits follow Conventional Commits format."
|
||||
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
|
||||
|
||||
build-and-test:
|
||||
name: Build & test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue