From efd0857dc49487d73b2e08936ea47b04e894a2b1 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 29 Jun 2026 17:39:16 +0200 Subject: [PATCH] feat: add no-run-logs-group as experimental option (#1403) --- README.md | 17 +++++++++++++++++ action.yml | 1 + dist/post_run/index.js | 12 ++++++++++-- dist/run/index.js | 12 ++++++++++-- src/run.ts | 16 ++++++++++++++-- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0b18ece..c487872 100644 --- a/README.md +++ b/README.md @@ -616,6 +616,23 @@ with: +#### `no-run-logs-group` + +(optional) + +This option disables the grouping of logs from golangci-lint run. + +
+Example + +```yaml +uses: golangci/golangci-lint-action@v9 +with: + experimental: "no-run-logs-group" +``` + +
+ ## Annotations Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/). diff --git a/action.yml b/action.yml index 48e8c9b..283e626 100644 --- a/action.yml +++ b/action.yml @@ -76,6 +76,7 @@ inputs: description: | Experimental options for the action. List of comma separated options. + Available options: `automatic-module-directories`, `no-run-logs-group` default: "" required: false runs: diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 249167a..997d59a 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -59467,15 +59467,23 @@ function modulesAutoDetection(rootDir) { async function runLint(binPath) { const workingDirectory = getWorkingDirectory(); const experimental = core.getInput(`experimental`).split(`,`); + const noGroup = experimental.includes(`no-run-logs-group`); if (experimental.includes(`automatic-module-directories`)) { const wds = modulesAutoDetection(workingDirectory); const cwd = process.cwd(); for (const wd of wds) { - await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd)); + await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd)); } return; } - await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory)); + await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory)); +} +async function optionalGroup(noGroup, name, fn) { + if (noGroup) { + core.info(name); + return fn(); + } + return core.group(name, fn); } async function run() { try { diff --git a/dist/run/index.js b/dist/run/index.js index a542b8a..318d9a3 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -59467,15 +59467,23 @@ function modulesAutoDetection(rootDir) { async function runLint(binPath) { const workingDirectory = getWorkingDirectory(); const experimental = core.getInput(`experimental`).split(`,`); + const noGroup = experimental.includes(`no-run-logs-group`); if (experimental.includes(`automatic-module-directories`)) { const wds = modulesAutoDetection(workingDirectory); const cwd = process.cwd(); for (const wd of wds) { - await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd)); + await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd)); } return; } - await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory)); + await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory)); +} +async function optionalGroup(noGroup, name, fn) { + if (noGroup) { + core.info(name); + return fn(); + } + return core.group(name, fn); } async function run() { try { diff --git a/src/run.ts b/src/run.ts index 7faeafb..031bdf4 100644 --- a/src/run.ts +++ b/src/run.ts @@ -205,19 +205,31 @@ async function runLint(binPath: string): Promise { const experimental = core.getInput(`experimental`).split(`,`) + const noGroup = experimental.includes(`no-run-logs-group`) + if (experimental.includes(`automatic-module-directories`)) { const wds = modulesAutoDetection(workingDirectory) const cwd = process.cwd() for (const wd of wds) { - await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd)) + await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd)) } return } - await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory)) + await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory)) +} + +async function optionalGroup(noGroup: boolean, name: string, fn: () => Promise): Promise { + if (noGroup) { + core.info(name) + + return fn() + } + + return core.group(name, fn) } export async function run(): Promise {