Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/linter.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Executes:
- [CodeQL](https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning-with-codeql) to analyze the code.
- [Ratchet](https://github.com/sethvargo/ratchet) to check that GitHub Action versions are pinned.

Commitlint is disabled by default for scheduled and manual runs, and for pushes
with no commits (such as creating a tag on an existing commit).
Explicit `linter-env` validator settings take precedence.

### Permissions

- **`actions`**: `read`
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# - [Hoverkraft Super-Linter](https://github.com/hoverkraft-tech/docker-base-images/tree/main/images/super-linter), shared with local linting.
# - [CodeQL](https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning-with-codeql) to analyze the code.
# - [Ratchet](https://github.com/sethvargo/ratchet) to check that GitHub Action versions are pinned.
#
# Commitlint is disabled by default for scheduled and manual runs, and for pushes
# with no commits (such as creating a tag on an existing commit).
# Explicit `linter-env` validator settings take precedence.

name: "Linter"
on:
Expand Down Expand Up @@ -114,9 +118,10 @@ jobs:
environment.set(key, line.slice(separatorIndex + 1));
}

// These events have no commit range for commitlint to validate.
// Pushes without commits (such as tag creation) also have no range to validate.
// FIXME: https://github.com/super-linter/super-linter/issues/7968
if (["schedule", "workflow_dispatch"].includes(context.eventName)) {
const isPushWithoutCommits = context.eventName === "push" && context.payload.commits?.length === 0;
if (["schedule", "workflow_dispatch"].includes(context.eventName) || isPushWithoutCommits) {
// An allowlist already excludes commitlint unless explicitly enabled.
const hasValidatorAllowlist = [...environment].some(([key, value]) =>
key.startsWith("VALIDATE_") && key !== "VALIDATE_ALL_CODEBASE" && value.toLowerCase() === "true"
Expand Down
Loading