From 14ddda6e2c94519ef50d54f55db77a7795a6ca8e Mon Sep 17 00:00:00 2001 From: nfebe Date: Tue, 14 Jul 2026 02:24:01 +0100 Subject: [PATCH] ci(commits): Adopt the shared commit-message validation action Replace the inline commitlint config with the shared action so the commit rules live in one place across repos instead of a copy per repository. --- .github/workflows/commits.yml | 48 +---------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/.github/workflows/commits.yml b/.github/workflows/commits.yml index ea4e0dc..beada07 100644 --- a/.github/workflows/commits.yml +++ b/.github/workflows/commits.yml @@ -10,50 +10,4 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install --save-dev @commitlint/{config-conventional,cli} - - - name: Create commitlint config file - run: | - cat << EOF > commitlint.config.js - export default { - extends: ['@commitlint/config-conventional'], - rules: { - 'type-enum': [2, 'always', [ - 'feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore', 'build', 'ci', - 'enh', 'enhance', 'tweak', 'imp', 'improve', - ]], - 'subject-case': [2, 'always', 'sentence-case'], - - 'header-max-length': [2, 'always', 80], - }, - ignores: [ - (commit) => commit.includes('Signed-off-by: dependabot[bot]') - ] - }; - EOF - - - name: Run commitlint - run: npx commitlint --from HEAD^ --to HEAD --config commitlint.config.js - - - name: Fail if commitlint fails (but not for Dependabot) - if: ${{ failure() && github.actor != 'dependabot[bot]'}} - run: | - echo "::error::Invalid commit message format. Please follow the conventional commit guidelines:" - echo "::error::- Type: One of: feat, fix, docs, style, refactor, test, chore, build, ci, enh, enhance, tweak, imp, improve" - echo "::error::- Scope (optional): A short name of the part of the codebase affected (e.g., 'auth', 'ui')." - echo "::error::- Subject: A brief description of the change, starting with a capital letter and generally in lowercase. Keep it concise (under 80 characters)." - echo "::error::- Body (optional): More detailed explanation of the change." - echo "::error::- Footer (optional): Related issue references, etc." - echo "" - echo "::error::Example:" - echo "::error::feat(user-authentication): Implement user login" - echo "" - echo "::error::For more information, see: [https://github.com/whilesmart/conventions/blob/main/commits.md]" - exit 1 + - uses: whilesmart/workflows/commits@main