From 3d54f619614b0bf0cfc761b4c6bec0d866996a92 Mon Sep 17 00:00:00 2001 From: przemarzec <98286080+przemarzec@users.noreply.github.com> Date: Wed, 3 Jun 2026 15:08:22 +0200 Subject: [PATCH] ci(ci): ignore merge commits in commitlint via JS config --- .commitlintrc.js | 82 ++++++++++++++++++++++++++++++++ .commitlintrc.yml | 74 ---------------------------- .github/workflows/commitlint.yml | 3 +- 3 files changed, 83 insertions(+), 76 deletions(-) create mode 100644 .commitlintrc.js delete mode 100644 .commitlintrc.yml diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..b4188c8 --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,82 @@ +// Commitlint config — enforces Conventional Commits 1.0.0 + the project scope allowlist. +// Reference: https://commitlint.js.org/ +// Used by .github/workflows/commitlint.yml to validate PR titles + commits. +// Scope list synced with docs/scopes.md (human-readable version). +// +// This is JS (not YAML) because `ignores` requires a predicate function: merge +// commits are not Conventional Commits, and the 4-tier branch flow +// (feature -> release -> dev -> main) produces merge commits at release -> dev +// and dev -> main. commitlint's built-in defaultIgnores only skips standard +// "Merge branch X into Y" / "Merge pull request" messages; an explicit ignore +// for any "Merge "-prefixed (and "Revert ") subject keeps the lint green for +// every merge commit regardless of how the message is phrased. + +module.exports = { + extends: ["@commitlint/config-conventional"], + + // Skip non-Conventional, git-generated commits. Belt-and-suspenders over + // commitlint's defaultIgnores (which stays enabled). + ignores: [ + (message) => + message.startsWith("Merge ") || message.startsWith("Revert "), + ], + + rules: { + "type-enum": [ + 2, + "always", + [ + "feat", + "fix", + "perf", + "docs", + "style", + "refactor", + "test", + "build", + "ci", + "chore", + "revert", + ], + ], + + "scope-enum": [ + 2, + "always", + [ + "core", + "domain", + "infra", + "dreaming", + "search", + "embedding", + "mindql", + "storage", + "extensions", + "cli", + "config", + "docs", + "bench", + "deps", + "release", + "ci", + "build", + ], + ], + + // warning only — some commits (e.g. pure `chore:`) may omit scope + "scope-empty": [1, "never"], + + "header-max-length": [2, "always", 100], + + "subject-full-stop": [2, "never", "."], + + "body-leading-blank": [2, "always"], + + "footer-leading-blank": [2, "always"], + + "type-empty": [2, "never"], + + "subject-empty": [2, "never"], + }, +}; diff --git a/.commitlintrc.yml b/.commitlintrc.yml deleted file mode 100644 index 316eb83..0000000 --- a/.commitlintrc.yml +++ /dev/null @@ -1,74 +0,0 @@ -# Commitlint config — enforces Conventional Commits 1.0.0 + engrava scope allowlist. -# Reference: https://commitlint.js.org/ -# Used by .github/workflows/commitlint.yml to validate PR titles + commits. -# Scope list synced with docs/scopes.md (human-readable version). - -extends: - - "@commitlint/config-conventional" - -rules: - type-enum: - - 2 - - always - - - feat - - fix - - perf - - docs - - style - - refactor - - test - - build - - ci - - chore - - revert - - scope-enum: - - 2 - - always - - - core - - domain - - infra - - dreaming - - search - - embedding - - mindql - - storage - - extensions - - cli - - config - - docs - - bench - - deps - - release - - ci - - build - - scope-empty: - - 1 # warning only — some commits (e.g. pure `chore:`) may omit scope - - never - - header-max-length: - - 2 - - always - - 100 - - subject-full-stop: - - 2 - - never - - "." - - body-leading-blank: - - 2 - - always - - footer-leading-blank: - - 2 - - always - - type-empty: - - 2 - - never - - subject-empty: - - 2 - - never diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index ac130d7..6fdff68 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -33,12 +33,11 @@ jobs: env: PR_TITLE: ${{ github.event.pull_request.title }} run: | - echo "$PR_TITLE" | npx commitlint --config .commitlintrc.yml + echo "$PR_TITLE" | npx commitlint - name: Lint commits in PR run: | npx commitlint \ - --config .commitlintrc.yml \ --from "${{ github.event.pull_request.base.sha }}" \ --to "${{ github.event.pull_request.head.sha }}" \ --verbose