mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-07-03 11:39:33 +00:00
feat: add no-run-logs-group as experimental option (#1403)
This commit is contained in:
parent
ed485de1ff
commit
efd0857dc4
5 changed files with 52 additions and 6 deletions
17
README.md
17
README.md
|
|
@ -616,6 +616,23 @@ with:
|
|||
|
||||
</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
|
||||
|
||||
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: |
|
||||
Experimental options for the action.
|
||||
List of comma separated options.
|
||||
Available options: `automatic-module-directories`, `no-run-logs-group`
|
||||
default: ""
|
||||
required: false
|
||||
runs:
|
||||
|
|
|
|||
12
dist/post_run/index.js
generated
vendored
12
dist/post_run/index.js
generated
vendored
|
|
@ -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 {
|
||||
|
|
|
|||
12
dist/run/index.js
generated
vendored
12
dist/run/index.js
generated
vendored
|
|
@ -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 {
|
||||
|
|
|
|||
16
src/run.ts
16
src/run.ts
|
|
@ -205,19 +205,31 @@ async function runLint(binPath: string): Promise<void> {
|
|||
|
||||
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<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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue