File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 with :
4444 fetch-depth : 0
4545
46- - uses : dafnik/commitlint@main
46+ - uses : dafnik/commitlint@main
Original file line number Diff line number Diff line change 33A simple GitHub action to run [ ` @commitlint/cli ` ] ( https://www.npmjs.com/package/@commitlint/cli ) checks.
44
55Following commits are linted based on the action ` event_name ` .
6+
67- ` push ` : The last commit
78 - from ` HEAD~1 ` to ` HEAD `
89- ` pull_request `
@@ -20,14 +21,17 @@ jobs:
2021 - name : Checkout Repository
2122 uses : actions/checkout@v4
2223 with :
23- fetch-depth : 0
24+ fetch-depth : 0
2425
2526 - name : Run commitlint
2627 uses : dafnik/commitlint@v1
27- with :
28+ # with:
2829 # commitlint_version: 'latest'
2930```
3031
32+ If the action doesn't find a ` commitlint.config.js ` it's going to install
33+ [ ` @commitlint/config-conventional ` ] ( https://www.npmjs.com/package/@commitlint/config-conventional ) and create a pre-generated ` commitlint.config.js ` .
34+
3135<!-- prettier-ignore-start -->
3236| Inputs | Default value | Description |
3337| ----------------------| ---------------| ------------------------------|
@@ -57,4 +61,4 @@ The scripts and documentation in this project are released under the [MIT Licens
5761[ release-list ] : https://github.com/dafnik/commitlint/releases
5862[ draft-release ] : .github/workflows/draft-release.yml
5963[ release ] : .github/workflows/release.yml
60- [ release-workflow-runs ] : https://github.com/dafnik/commitlint/actions/workflows/release.yml
64+ [ release-workflow-runs ] : https://github.com/dafnik/commitlint/actions/workflows/release.yml
Original file line number Diff line number Diff line change 2525 shell : bash
2626 run : npm install --global commitlint@${{ inputs.commitlint_version }} @commitlint/config-conventional
2727
28+ - name : Check if commitlint.config.js exists
29+ shell : bash
30+ id : check-file
31+ run : |
32+ if [ -f commitlint.config.js ]; then
33+ echo "exists=true" >> $GITHUB_OUTPUT
34+ else
35+ echo "exists=false" >> $GITHUB_OUTPUT
36+ fi
37+
38+ - name : Installing @commitlint/config-conventional
39+ shell : bash
40+ if : steps.check-file.outputs.exists == 'false'
41+ run : npm install --global @commitlint/config-conventional
42+
43+ - name : Creating commitlint.config.js
44+ shell : bash
45+ if : steps.check-file.outputs.exists == 'false'
46+ run : |
47+ echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
48+
49+ - name : Verify commitlint.config.js content
50+ shell : bash
51+ run : cat commitlint.config.js
52+
2853 - name : Validate current commit (last commit) with commitlint
2954 shell : bash
3055 if : github.event_name == 'push'
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments