Skip to content

Commit

Permalink
build: use commitlint to enforce conventional commits
Browse files Browse the repository at this point in the history
  • Loading branch information
fengelniederhammer committed Apr 25, 2024
1 parent 13c1e02 commit c93f053
Show file tree
Hide file tree
Showing 8 changed files with 1,536 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { RuleConfigSeverity } from "@commitlint/types";

/**
* @type {import('@commitlint/types').UserConfig}
*/
const Configuration = {
extends: ["@commitlint/config-conventional"],
rules: {
"body-max-line-length": [RuleConfigSeverity.Error, "always", 200],
},
};

export default Configuration;
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ updates:
directory: endToEndTests/
schedule:
interval: weekly
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
minorAndPatch:
update-types:
- "minor"
- "patch"
30 changes: 30 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Commitlint

on:
pull_request:
types:
- ready_for_review

jobs:
commitlint:
name: Lint commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: lts/*

- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}

- name: Install npm packages
run: npm ci

- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --verbose
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ conanprofile
**/output/
**/logs/
**/temp/

**/node_modules/
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,17 @@ The includes are sorted in the following order:
4. Internal includes

Internal includes are marked by double quotes. External includes are marked by angle brackets.

## Conventional Commits

We follow the [conventional commits](https://www.conventionalcommits.org/) guidelines for commit messages.
This will allow to automatically generate a changelog.

We use [commitlint](https://commitlint.js.org/) to enforce the commit message format.
To use it locally, run `npm install`.

The last commit message can be checked with

```shell
npm run commitlint:last-commit
```
1 change: 0 additions & 1 deletion endToEndTests/.gitignore

This file was deleted.

Loading

0 comments on commit c93f053

Please sign in to comment.