diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1fe87f6..e2c138c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,6 +2,9 @@ version: 2 updates: - package-ecosystem: docker + commit-message: + prefix: build + include: scope open-pull-requests-limit: 20 directory: "/" schedule: @@ -16,6 +19,9 @@ updates: - "*" - package-ecosystem: docker + commit-message: + prefix: build + include: scope open-pull-requests-limit: 20 directories: - "/images/*" @@ -28,6 +34,9 @@ updates: default-days: 7 - package-ecosystem: npm + commit-message: + prefix: build + include: scope open-pull-requests-limit: 20 directory: "/images/testcontainers-node" schedule: @@ -42,6 +51,9 @@ updates: - "*" - package-ecosystem: github-actions + commit-message: + prefix: build + include: scope open-pull-requests-limit: 20 directories: - "/" @@ -58,6 +70,9 @@ updates: - "*" - package-ecosystem: "devcontainers" + commit-message: + prefix: build + include: scope open-pull-requests-limit: 20 directory: "/" schedule: diff --git a/images/super-linter/README.md b/images/super-linter/README.md index 431fb94..83ffbde 100644 --- a/images/super-linter/README.md +++ b/images/super-linter/README.md @@ -169,6 +169,12 @@ arguments supplied through `GITHUB_ACTIONS_COMMAND_ARGS` are preserved. ## Commitlint configuration +The shared policy is the unmodified +[`@commitlint/config-conventional` preset](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional), +including its Conventional Commits parser. It accepts breaking-change headers +such as `feat!:` and applies the same rules to contributor and bot messages. +The preset and validator versions are supplied by the pinned image. + Commitlint discovers project configuration itself, including parent directories and the `commitlint` field in `package.json` or `package.yaml`. Project rules take precedence over the bundled rules. diff --git a/images/super-linter/commitlint.config.cjs b/images/super-linter/commitlint.config.cjs index ff7a081..26a88cb 100644 --- a/images/super-linter/commitlint.config.cjs +++ b/images/super-linter/commitlint.config.cjs @@ -1,33 +1,3 @@ module.exports = { - rules: { - "body-leading-blank": [1, "always"], - "footer-leading-blank": [1, "always"], - "header-max-length": [2, "always", 100], - "subject-case": [ - 2, - "never", - ["sentence-case", "start-case", "pascal-case", "upper-case"], - ], - "subject-empty": [2, "never"], - "subject-full-stop": [2, "never", "."], - "type-case": [2, "always", "lower-case"], - "type-empty": [2, "never"], - "type-enum": [ - 2, - "always", - [ - "build", - "chore", - "ci", - "docs", - "feat", - "fix", - "perf", - "refactor", - "revert", - "style", - "test", - ], - ], - }, + extends: ["@commitlint/config-conventional"], }; diff --git a/images/super-linter/super-linter.test.js b/images/super-linter/super-linter.test.js index 7e55990..1469e61 100644 --- a/images/super-linter/super-linter.test.js +++ b/images/super-linter/super-linter.test.js @@ -234,17 +234,31 @@ exec sleep infinity`, for (const [message, expectedExitCode] of [ ["feat: add a shared linter", 0], + ["feat!: change the release contract", 0], + [ + "feat(api)!: change the release contract\n\nBREAKING CHANGE: callers must supply a release tag", + 0, + ], + ["build(deps): bump a dependency", 0], + ["build(deps): Bump a dependency", 1], + [ + "unknown(deps): bump a dependency\n\nupdated-dependencies:\n- dependency-name: example\n\nSigned-off-by: dependabot[bot] ", + 1, + ], + ["fix: keep headers bounded ".padEnd(101, "x"), 1], + [`fix: keep body lines bounded\n\n${"x".repeat(101)}`, 1], + ["fix: end a subject with a full stop.", 1], ["invalid commit message", 1], ]) { it(`validates '${message}' without writing in the workspace`, async () => { - const { exitCode, workspace } = await runEntrypoint( + const { exitCode, output, workspace } = await runEntrypoint( [ "-c", 'printf "%s\\n" "$COMMIT_MESSAGE" | commitlint --cwd "$DEFAULT_WORKSPACE"', ], { COMMIT_MESSAGE: message }, ); - assert.strictEqual(exitCode, expectedExitCode); + assert.strictEqual(exitCode, expectedExitCode, output); const files = await container.exec(["ls", "-A", workspace]); assert.strictEqual(files.output, ""); }); diff --git a/images/super-linter/tests/commitlint.sh b/images/super-linter/tests/commitlint.sh index 10e2be2..e9560ce 100755 --- a/images/super-linter/tests/commitlint.sh +++ b/images/super-linter/tests/commitlint.sh @@ -7,6 +7,7 @@ git init --quiet --initial-branch=main git config user.name Test git config user.email test@example.com git commit --quiet --allow-empty -m 'feat: initialize fixture' +git commit --quiet --allow-empty -m 'feat!: change the fixture contract' export DEFAULT_WORKSPACE="$workspace" export VALIDATE_JAVASCRIPT_TOOLCHAIN='' VALIDATE_PYTHON_TOOLCHAIN=''