Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 6bb1e77

Browse files
authored
Merge pull request #595 from BlasiusSecundus/feature/commitlint
Add commitlint - use conventional commits consistently
2 parents f6552aa + 27038dd commit 6bb1e77

File tree

6 files changed

+1313
-4
lines changed

6 files changed

+1313
-4
lines changed

.github/workflows/pull-request.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
uses: actions/setup-java@v2
2323
with:
2424
distribution: 'zulu'
25-
java-version: 15
25+
java-version: 11
2626
- name: Cache Gradle
2727
uses: actions/cache@v2
2828
env:
29-
java-version: 15
29+
java-version: 11
3030
with:
3131
path: |
3232
~/.gradle/caches
@@ -38,14 +38,31 @@ jobs:
3838
- name: Gradle Check
3939
run: ./gradlew --info build -x test
4040

41+
commitlint:
42+
name: Validate conventional commits
43+
runs-on: ubuntu-latest
44+
needs: validation
45+
steps:
46+
- uses: actions/checkout@v2
47+
name: Checkout
48+
with:
49+
fetch-depth: 0
50+
- uses: actions/setup-node@v1
51+
name: Setup Node
52+
with:
53+
node-version: 14
54+
- run: cd commitlint && npm audit
55+
name: Security audit of NPM packages
56+
- run: cd commitlint && npm ci && git ls-remote https://github.com/graphql-java-kickstart/graphql-spring-boot.git HEAD | grep -o '[0-9a-f]*' | xargs -I{} npx commitlint --from {} --verbose
57+
name: Run commitlint
4158
test:
4259
name: Test run
4360
strategy:
4461
fail-fast: false
4562
matrix:
4663
os: [ ubuntu-latest, macos-latest, windows-latest ]
4764
java: [ 8, 11, 16 ]
48-
needs: validation
65+
needs: [validation, commitlint, verify-google-java-format]
4966
runs-on: ${{ matrix.os }}
5067
steps:
5168
- name: Checkout
@@ -78,7 +95,7 @@ jobs:
7895

7996
build:
8097
name: Sonar analysis
81-
needs: validation
98+
needs: test
8299
runs-on: ubuntu-latest
83100
env:
84101
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ fabric.properties
6464
# Mac
6565

6666
.DS_Store
67+
68+
# Node
69+
70+
**/node_modules
71+
**/.husky

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,26 @@ It would also be very helpful to install the SonarLint plugin in your IDE and fi
5151
SonarLint issues before pushing a PR. We're aware that the current state of the code raises a lot of
5252
SonarLint issues out of the box, but any help in reducing that is appreciated. More importantly we
5353
don't increase that technical debt.
54+
55+
###Commit messages
56+
57+
This project uses the [Conventional Commits](https://www.conventionalcommits.org) specification for commit messages.
58+
The CI pipeline validates that commit messages adhere to the specification using
59+
[commitlint](https://github.com/conventional-changelog/commitlint).
60+
61+
**Note**: *Historical commits, made before applying this convention may not fulfill the requirements of the
62+
specification. These commits are exempt from this check.*
63+
64+
To check commit messages before committing, go to the `commitlint` folder and run `npm ci && npm run add-commitlint-git-hook`
65+
(you will need NodeJS installed on your machine). This command sets up a git hook to run commitlint before each commit,
66+
to prevent committing with invalid commit messages in the first place.
67+
68+
**Note**: *Please always use `npm ci` instead of `install` to prevent unwanted changes to `package-lock.json`.*
69+
70+
To remove the git hook, just delete the `commitlint/.husky` folder.
71+
72+
As for the optional scope part of the commit message:
73+
- if your commit addresses an issue, please refer the issue number in the scope - e.g. `fix(#123): ...`
74+
- otherwise, if applicable, please use the modified / affected subproject name, without the repetitive prefix/postfix
75+
parts (like `graphql-kickstart-spring-boot`, `spring-boot-starter` or `autoconfigure`) - e.g. `feat(webflux): ...`
76+

commitlint/commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {extends: ['@commitlint/config-conventional']}

0 commit comments

Comments
 (0)