mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-07-04 23:51:37 +00:00
feat: add no-run-logs-group as experimental option (#1403)
This commit is contained in:
committed by
GitHub
parent
ed485de1ff
commit
efd0857dc4
@@ -616,6 +616,23 @@ with:
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
#### `no-run-logs-group`
|
||||||
|
|
||||||
|
(optional)
|
||||||
|
|
||||||
|
This option disables the grouping of logs from golangci-lint run.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Example</summary>
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: golangci/golangci-lint-action@v9
|
||||||
|
with:
|
||||||
|
experimental: "no-run-logs-group"
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Annotations
|
## Annotations
|
||||||
|
|
||||||
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ inputs:
|
|||||||
description: |
|
description: |
|
||||||
Experimental options for the action.
|
Experimental options for the action.
|
||||||
List of comma separated options.
|
List of comma separated options.
|
||||||
|
Available options: `automatic-module-directories`, `no-run-logs-group`
|
||||||
default: ""
|
default: ""
|
||||||
required: false
|
required: false
|
||||||
runs:
|
runs:
|
||||||
|
|||||||
+10
-2
@@ -59467,15 +59467,23 @@ function modulesAutoDetection(rootDir) {
|
|||||||
async function runLint(binPath) {
|
async function runLint(binPath) {
|
||||||
const workingDirectory = getWorkingDirectory();
|
const workingDirectory = getWorkingDirectory();
|
||||||
const experimental = core.getInput(`experimental`).split(`,`);
|
const experimental = core.getInput(`experimental`).split(`,`);
|
||||||
|
const noGroup = experimental.includes(`no-run-logs-group`);
|
||||||
if (experimental.includes(`automatic-module-directories`)) {
|
if (experimental.includes(`automatic-module-directories`)) {
|
||||||
const wds = modulesAutoDetection(workingDirectory);
|
const wds = modulesAutoDetection(workingDirectory);
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
for (const wd of wds) {
|
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;
|
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() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+10
-2
@@ -59467,15 +59467,23 @@ function modulesAutoDetection(rootDir) {
|
|||||||
async function runLint(binPath) {
|
async function runLint(binPath) {
|
||||||
const workingDirectory = getWorkingDirectory();
|
const workingDirectory = getWorkingDirectory();
|
||||||
const experimental = core.getInput(`experimental`).split(`,`);
|
const experimental = core.getInput(`experimental`).split(`,`);
|
||||||
|
const noGroup = experimental.includes(`no-run-logs-group`);
|
||||||
if (experimental.includes(`automatic-module-directories`)) {
|
if (experimental.includes(`automatic-module-directories`)) {
|
||||||
const wds = modulesAutoDetection(workingDirectory);
|
const wds = modulesAutoDetection(workingDirectory);
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
for (const wd of wds) {
|
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;
|
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() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+14
-2
@@ -205,19 +205,31 @@ async function runLint(binPath: string): Promise<void> {
|
|||||||
|
|
||||||
const experimental = core.getInput(`experimental`).split(`,`)
|
const experimental = core.getInput(`experimental`).split(`,`)
|
||||||
|
|
||||||
|
const noGroup = experimental.includes(`no-run-logs-group`)
|
||||||
|
|
||||||
if (experimental.includes(`automatic-module-directories`)) {
|
if (experimental.includes(`automatic-module-directories`)) {
|
||||||
const wds = modulesAutoDetection(workingDirectory)
|
const wds = modulesAutoDetection(workingDirectory)
|
||||||
|
|
||||||
const cwd = process.cwd()
|
const cwd = process.cwd()
|
||||||
|
|
||||||
for (const wd of wds) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory))
|
await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory))
|
||||||
|
}
|
||||||
|
|
||||||
|
async function optionalGroup<T>(noGroup: boolean, name: string, fn: () => Promise<T>): Promise<T> {
|
||||||
|
if (noGroup) {
|
||||||
|
core.info(name)
|
||||||
|
|
||||||
|
return fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
return core.group(name, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user