From 4a0bab82ebb1839af8fb70780202c02dca2fac03 Mon Sep 17 00:00:00 2001 From: nfebe Date: Tue, 14 Jul 2026 05:14:04 +0100 Subject: [PATCH] fix(commits): Write the generated commitlint config as a cjs file The action wrote commitlint.config.js with module.exports. In a repository whose package.json sets "type": "module", node treats that file as an ES module and the run fails with "module is not defined in ES module scope". A .cjs file stays CommonJS regardless of the consumer's module type, so the config loads in both module and commonjs repositories. --- commits/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commits/action.yml b/commits/action.yml index 2cba9e1..66e4df3 100644 --- a/commits/action.yml +++ b/commits/action.yml @@ -31,7 +31,7 @@ runs: - name: Write commitlint config shell: bash run: | - cat << 'EOF' > commitlint.config.js + cat << 'EOF' > commitlint.config.cjs module.exports = { extends: ['@commitlint/config-conventional'], rules: { @@ -50,7 +50,7 @@ runs: - name: Run commitlint shell: bash - run: npx commitlint --from "${{ inputs.from }}" --to "${{ inputs.to }}" --config commitlint.config.js + run: npx commitlint --from "${{ inputs.from }}" --to "${{ inputs.to }}" --config commitlint.config.cjs - name: Explain the rules on failure if: ${{ failure() && github.actor != 'dependabot[bot]' }}