diff --git a/action.yml b/action.yml index 3e5d74d..4b03858 100644 --- a/action.yml +++ b/action.yml @@ -34,6 +34,10 @@ inputs: description: "if set to true then the action doesn't cache or restore ~/.cache/go-build." default: false required: false + allow-extra-out-format-args: + description: "if set to true then the action allows additional --out-format args (default of --out-format=github-actions remains)" + default: false + required: false runs: using: "node16" main: "dist/run/index.js" diff --git a/src/run.ts b/src/run.ts index 2fd55d5..e72026d 100644 --- a/src/run.ts +++ b/src/run.ts @@ -117,6 +117,7 @@ async function runLint(lintPath: string, patchPath: string): Promise { } const userArgs = core.getInput(`args`) + const allowExtraOutFormatArgs = core.getInput(`allow-extra-out-format-args`) const addedArgs: string[] = [] const userArgNames = new Set( @@ -127,8 +128,9 @@ async function runLint(lintPath: string, patchPath: string): Promise { .filter((arg) => arg.startsWith(`-`)) .map((arg) => arg.replace(/^-+/, ``)) ) - if (userArgNames.has(`out-format`)) { - throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`) + if (userArgNames.has(`out-format`) && !allowExtraOutFormatArgs) { + throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a + future version (set 'allow-extra-out-format-args' input to true to override)`) } addedArgs.push(`--out-format=github-actions`)