From ed8381f61e4613f73b4a6800e39d9b8852db87ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Harper?= Date: Wed, 20 Sep 2023 10:04:14 -0400 Subject: [PATCH] ci: don't include PR number is commit linting lenght for titles (#1822) --- .commitlint.json | 6 ------ .commitlintrc.js | 17 +++++++++++++++++ .github/workflows/check-commits.yml | 6 +++--- 3 files changed, 20 insertions(+), 9 deletions(-) delete mode 100644 .commitlint.json create mode 100644 .commitlintrc.js diff --git a/.commitlint.json b/.commitlint.json deleted file mode 100644 index 0e5f369f1..000000000 --- a/.commitlint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parserPreset": "conventional-changelog-conventionalcommits", - "rules": { - "header-max-length": [2, "always", 72] - } -} diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 000000000..d9cf89655 --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,17 @@ +const rules = require('@commitlint/rules'); + +module.exports = { + rules: { + 'header-max-length': [2, 'always', 72], + }, + plugins: [ + { + rules: { + 'header-max-length': (parsed, _when, _value) => { + parsed.header = parsed.header.replace(/\s\(#[0-9]+\)$/, '') + return rules.default['header-max-length'](parsed, _when, _value) + }, + }, + }, + ] +} \ No newline at end of file diff --git a/.github/workflows/check-commits.yml b/.github/workflows/check-commits.yml index d63c7aed4..05bd4242c 100644 --- a/.github/workflows/check-commits.yml +++ b/.github/workflows/check-commits.yml @@ -7,12 +7,12 @@ jobs: steps: - name: Checkout the code - uses: actions/checkout@main + uses: actions/checkout@v4.0.0 with: fetch-depth: 0 - name: Lint the commits - uses: wagoid/commitlint-github-action@v5 + uses: wagoid/commitlint-github-action@v5.4.3 with: - configFile: .commitlint.json + configFile: .commitlintrc.js failOnWarnings: true