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

Commit d8cd922

Browse files
chore: add commitlint
Also add separate contributing guideline file.
1 parent 92bc41c commit d8cd922

File tree

6 files changed

+1309
-2
lines changed

6 files changed

+1309
-2
lines changed

.github/workflows/pull-request.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,29 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: gradle/wrapper-validation-action@v1
13+
commitlint:
14+
name: Validate conventional commits
15+
runs-on: ubuntu-latest
16+
needs: validation
17+
steps:
18+
- uses: actions/checkout@v2
19+
name: Checkout
20+
with:
21+
fetch-depth: 0
22+
- uses: actions/setup-node@v1
23+
name: Setup Node
24+
with:
25+
node-version: 14
26+
- run: cd commitlint && npm ci && npm audit && 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
27+
name: Run commitlint
1328
test:
1429
name: Test run
1530
strategy:
1631
fail-fast: false
1732
matrix:
1833
os: [ ubuntu-latest, macos-latest, windows-latest ]
1934
java: [ 8, 11, 15 ]
20-
needs: validation
35+
needs: [validation, commitlint]
2136
runs-on: ${{ matrix.os }}
2237
steps:
2338
- name: Checkout
@@ -50,7 +65,7 @@ jobs:
5065
run: gradlew --info check
5166
build:
5267
name: Sonar analysis
53-
needs: validation
68+
needs: [validation, commitlint]
5469
runs-on: ubuntu-latest
5570
env:
5671
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

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

6565
.DS_Store
66+
67+
# Node
68+
69+
**/node_modules
70+
**/.husky

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
###Commit messages
3+
4+
This project uses the [Conventional Commits](https://www.conventionalcommits.org) specification for commit messages.
5+
The CI pipeline validates that commit messages adhere to the specification using
6+
[commitlint](https://github.com/conventional-changelog/commitlint).
7+
8+
**Note**: *Historical commits, made before applying this convention may not fulfill the requirements of the
9+
specification. These commits are exempt from this check.*
10+
11+
To check commit messages before committing, go to the `commitlint` folder and run `npm ci && npm run add-commitlint-git-hook`
12+
(you will need NodeJS installed on your machine). This command sets up a git hook to run commitlint before each commit,
13+
to prevent committing with invalid commit messages in the first place.
14+
15+
**Note**: *Please always use `npm ci` instead of `install` to prevent unwanted changes to `package-lock.json`.*
16+
17+
To remove the git hook, just delete the `commitlint/.husky` folder.
18+
19+
As for the optional scope part of the commit message:
20+
- if your commit addresses an issue, please refer the issue number in the scope - e.g. `fix(#123): ...`
21+
- otherwise, if applicable, please use the modified / affected subproject name, without the repetitive prefix/postfix
22+
parts (like `graphql-kickstart-spring-boot`, `spring-boot-starter` or `autoconfigure`) - e.g. `feat(webflux): ...`
23+

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)