Skip to content

Commit 30a8dc6

Browse files
committed
Added commit validation
1 parent 5938926 commit 30a8dc6

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Validate Commit Messages
2+
3+
on:
4+
push:
5+
branches:
6+
- omric/merge-commit-test
7+
8+
jobs:
9+
validate-commits:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # needed to get full commit history
16+
17+
- name: Install commitlint
18+
run: |
19+
npm install -g @commitlint/{cli,config-conventional}
20+
21+
- name: Validate commit messages
22+
run: |
23+
# Get commits in this push
24+
COMMITS=$(git log ${{ github.event.before }}..${{ github.sha }} --pretty=format:%s)
25+
26+
echo "Checking commits:"
27+
echo "$COMMITS"
28+
29+
echo "$COMMITS" | while read line; do
30+
if [ -n "$line" ]; then
31+
echo "$line" | npx commitlint
32+
fi
33+
done

pkg/env-tests/commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)