Skip to content

Commit 92d8977

Browse files
authored
Merge pull request #6 from woaitsAryan/master
feat: added commit linter
2 parents c2587a8 + df2e66b commit 92d8977

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Continous integration
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_and_lint:
7+
timeout-minutes: 30
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 18
16+
- name: Install commitlint
17+
run: |
18+
npm i -g @commitlint/config-conventional @commitlint/cli
19+
20+
- name: Install dependancies and build
21+
run: |
22+
if [ -f package.json ]; then
23+
npm ci
24+
npm run build
25+
else
26+
echo "package.json not found, skipping build step"
27+
fi
28+
shell: bash
29+
30+
- name: Validate commit messages
31+
if: github.event_name == 'push'
32+
run: |
33+
commitlint -x @commitlint/config-conventional --from HEAD~1 --to HEAD --verbose
34+
35+
- name: Validate PR commits with commitlint
36+
if: github.event_name == 'pull_request'
37+
run: commitlint -x @commitlint/config-conventional --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 commit comments

Comments
 (0)