Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"type-enum": [
2,
"always",
[

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some commits in history use cleanup, do we want that added?

"build",
"chore",
"ci",
"docs",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only docs valid, or also doc makes sense?

"feat",
"fix",
"perf",
"refactor",
"revert",
"security",
"style",
"test"
]
],
"subject-case": [
2,
"always",
[
"sentence-case",
"start-case",
"pascal-case",
"upper-case"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for release-please to pass will be needing an addition in

"release-type": "simple",

something like this might be an option

"pull-request-title-pattern": "chore${scope}: Release${component} ${version}"

]
],
"header-max-length": [
2,
"always",
120
]
}
}
57 changes: 57 additions & 0 deletions .github/workflows/compliance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

name: Compliance checks

on:
pull_request:
branches: [master, main]

permissions:
contents: read

jobs:
conventional-commits:
name: Conventional commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-node@v5
with:
node-version: "20"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node 20 is deprecated


- name: Install commitlint
run: npm install --no-save @commitlint/cli @commitlint/config-conventional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also pin this as the same version?


# The merge commit takes the PR title, so that is what Release Please reads.
- name: Fail if the pull request title is not a conventional commit
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if ! printf '%s\n' "$PR_TITLE" | npx commitlint --verbose; then
echo ""
echo "The pull request title becomes the merge commit subject on master."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to use merge-commits to master? Looks to me that we are using rebase-merge nowadays, at least in the last few PRs I checked

echo "Use a conventional commit subject, for example:"
echo ""
echo " fix: Coding style"
echo ""
exit 1
fi

- name: Fail if a commit in this branch is not a conventional commit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may think if you want to use wagoid/commitlint-github-action@v6 to shorten this part, it does this iteration by itself

run: |
BASE=${{ github.event.pull_request.base.sha }}
HEAD=${{ github.event.pull_request.head.sha }}
if ! npx commitlint --from "$BASE" --to "$HEAD" --verbose; then
echo ""
echo "Rewrite the offending commit messages, then force-push:"
echo ""
echo " git rebase -i $BASE"
echo " git push --force-with-lease"
echo ""
echo "Or install the pre-commit hooks (see CONTRIBUTING.md) to catch this locally."
exit 1
fi
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# commitlint runs at commit-msg, so plain `pre-commit install` must wire that stage too.
default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand Down Expand Up @@ -73,6 +77,13 @@ repos:
hooks:
- id: reuse-lint-file

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: "v9.26.0"
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@commitlint/config-conventional@19.8.1"]

- repo: local
hooks:
- id: dco-hook
Expand Down
Loading