File tree Expand file tree Collapse file tree 1 file changed +35
-5
lines changed Expand file tree Collapse file tree 1 file changed +35
-5
lines changed Original file line number Diff line number Diff line change 11name : commitlint
22description : Lint commit messages with GitHub Actions.
33author : remarkablemark
4+
45inputs :
5- version :
6- description : Description
7- default : 1.2.3
6+ from :
7+ description : Lower end of the commit range to lint
8+ default : HEAD~1
9+
810runs :
911 using : composite
1012 steps :
11- - run : |
12- echo 'version: ${{ inputs.version }}'
13+ - name : Install commitlint
1314 shell : bash
15+ run : |
16+ command -v commitlint || npm install --global commitlint
17+ commitlint --version
18+
19+ - name : Check config
20+ shell : bash
21+ run : |
22+ CONFIG=$(commitlint --print-config --no-color)
23+
24+ RULES_LENGTH=$(node << EOF
25+ const config = $CONFIG;
26+ console.log(Object.keys(config.rules).length);
27+ EOF)
28+
29+ if [[ $RULES_LENGTH == 0 ]]; then
30+ npm install --global @commitlint/config-conventional
31+ echo '{"extends":["@commitlint/config-conventional"]}' > .commitlintrc.json
32+ fi
33+
34+ - name : Run commitlint
35+ shell : bash
36+ run : commitlint --from=${{ inputs.from }}
37+
38+ - name : Cleanup
39+ shell : bash
40+ run : |
41+ npm uninstall --global commitlint @commitlint/config-conventional
42+ git reset --hard && git clean -d --force
43+
1444branding :
1545 icon : terminal
1646 color : gray-dark
You can’t perform that action at this time.
0 commit comments