Skip to content

Commit d65c876

Browse files
chainchadldez
authored andcommitted
Support extra --out-format args
1 parent 5f1fec7 commit d65c876

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ inputs:
3434
description: "if set to true then the action doesn't cache or restore ~/.cache/go-build."
3535
default: false
3636
required: false
37+
allow-extra-out-format-args:
38+
description: "if set to true then the action allows additional --out-format args (default of --out-format=github-actions remains)"
39+
default: false
40+
required: false
3741
runs:
3842
using: "node16"
3943
main: "dist/run/index.js"

src/run.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
117117
}
118118

119119
const userArgs = core.getInput(`args`)
120+
const allowExtraOutFormatArgs = core.getInput(`allow-extra-out-format-args`)
120121
const addedArgs: string[] = []
121122

122123
const userArgNames = new Set<string>(
@@ -127,8 +128,9 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
127128
.filter((arg) => arg.startsWith(`-`))
128129
.map((arg) => arg.replace(/^-+/, ``))
129130
)
130-
if (userArgNames.has(`out-format`)) {
131-
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
131+
if (userArgNames.has(`out-format`) && !allowExtraOutFormatArgs) {
132+
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a
133+
future version (set 'allow-extra-out-format-args' input to true to override)`)
132134
}
133135
addedArgs.push(`--out-format=github-actions`)
134136

0 commit comments

Comments
 (0)