File tree Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 43
43
with :
44
44
fetch-depth : 0
45
45
46
- - uses : dafnik/commitlint@main
46
+ - uses : dafnik/commitlint@main
Original file line number Diff line number Diff line change 3
3
A simple GitHub action to run [ ` @commitlint/cli ` ] ( https://www.npmjs.com/package/@commitlint/cli ) checks.
4
4
5
5
Following commits are linted based on the action ` event_name ` .
6
+
6
7
- ` push ` : The last commit
7
8
- from ` HEAD~1 ` to ` HEAD `
8
9
- ` pull_request `
@@ -20,14 +21,17 @@ jobs:
20
21
- name : Checkout Repository
21
22
uses : actions/checkout@v4
22
23
with :
23
- fetch-depth : 0
24
+ fetch-depth : 0
24
25
25
26
- name : Run commitlint
26
27
uses : dafnik/commitlint@v1
27
- with :
28
+ # with:
28
29
# commitlint_version: 'latest'
29
30
```
30
31
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
+
31
35
<!-- prettier-ignore-start -->
32
36
| Inputs | Default value | Description |
33
37
| ----------------------| ---------------| ------------------------------|
@@ -57,4 +61,4 @@ The scripts and documentation in this project are released under the [MIT Licens
57
61
[ release-list ] : https://github.com/dafnik/commitlint/releases
58
62
[ draft-release ] : .github/workflows/draft-release.yml
59
63
[ 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 25
25
shell : bash
26
26
run : npm install --global commitlint@${{ inputs.commitlint_version }} @commitlint/config-conventional
27
27
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
+
28
53
- name : Validate current commit (last commit) with commitlint
29
54
shell : bash
30
55
if : github.event_name == 'push'
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments