From da46ba88fe0c0735681caa661d54fe43894aab22 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 31 Jul 2026 08:27:29 +0200 Subject: [PATCH] chore: Add commitlint configuration and compliance checks Signed-off-by: Steffen Vogel --- .commitlintrc.json | 42 +++++++++++++++++++++++++++++++ .github/workflows/compliance.yaml | 25 ++++++++++++++++++ .pre-commit-config.yaml | 11 ++++++++ release-please-config.json | 1 + 4 files changed, 79 insertions(+) create mode 100644 .commitlintrc.json create mode 100644 .github/workflows/compliance.yaml diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 000000000..b4b81e5d5 --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,42 @@ +{ + "extends": [ + "@commitlint/config-conventional" + ], + "rules": { + "type-enum": [ + 2, + "always", + [ + "build", + "chore", + "ci", + "cleanup", + "docs", + "doc", + "feat", + "fix", + "perf", + "refactor", + "revert", + "security", + "style", + "test" + ] + ], + "subject-case": [ + 2, + "always", + [ + "sentence-case", + "start-case", + "pascal-case", + "upper-case" + ] + ], + "header-max-length": [ + 2, + "always", + 120 + ] + } +} diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml new file mode 100644 index 000000000..291b1af4b --- /dev/null +++ b/.github/workflows/compliance.yaml @@ -0,0 +1,25 @@ +# 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 + pull-requests: read + +jobs: + conventional-commits: + name: Conventional commit messages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - uses: wagoid/commitlint-github-action@v6 + with: + configFile: .commitlintrc.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e73ea634..e5327e624 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,10 @@ default_stages: [pre-commit] # 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 @@ -76,6 +80,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 diff --git a/release-please-config.json b/release-please-config.json index 31aebf9ef..6d411deb4 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,6 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "release-type": "simple", + "pull-request-title-pattern": "chore${scope}: Release${component} ${version}", "packages": { ".": { "extra-files": [