mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-08-30 13:01:40 +00:00
feat: add no-run-logs-group as experimental option (#1403)
This commit is contained in:
committed by
GitHub
parent
ed485de1ff
commit
efd0857dc4
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> {
|
||||
|
||||
Reference in New Issue
Block a user