diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 25c77c3..5a336f1 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -66575,16 +66575,27 @@ function runLint(lintPath, patchPath) { } const userArgs = core.getInput(`args`); const addedArgs = []; - const userArgNames = new Set(userArgs + const userArgsList = userArgs .trim() .split(/\s+/) - .map((arg) => arg.split(`=`)[0]) .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`); + .map((arg) => arg.replace(/^-+/, ``)) + .map((arg) => arg.split(/=(.*)/, 2)) + .map(([key, value]) => [key, value !== null && value !== void 0 ? value : '']); + const userArgsMap = new Map(userArgsList); + const userArgNames = new Set(userArgsList.map(([key, value]) => key)); + const formats = userArgsMap.get('out-format'); + if (formats) { + if (formats.includes('github-actions')) { + addedArgs.push(`--out-format=${formats}`); + } + else { + addedArgs.push(`--out-format=github-actions,${formats}`); + } + } + else { + addedArgs.push(`--out-format=github-actions`); } - addedArgs.push(`--out-format=github-actions`); if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { throw new Error(`please, don't specify manually --new* args when requesting only new issues`); diff --git a/dist/run/index.js b/dist/run/index.js index 6dbd2dc..518cb5f 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -66575,16 +66575,27 @@ function runLint(lintPath, patchPath) { } const userArgs = core.getInput(`args`); const addedArgs = []; - const userArgNames = new Set(userArgs + const userArgsList = userArgs .trim() .split(/\s+/) - .map((arg) => arg.split(`=`)[0]) .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`); + .map((arg) => arg.replace(/^-+/, ``)) + .map((arg) => arg.split(/=(.*)/, 2)) + .map(([key, value]) => [key, value !== null && value !== void 0 ? value : '']); + const userArgsMap = new Map(userArgsList); + const userArgNames = new Set(userArgsList.map(([key, value]) => key)); + const formats = userArgsMap.get('out-format'); + if (formats) { + if (formats.includes('github-actions')) { + addedArgs.push(`--out-format=${formats}`); + } + else { + addedArgs.push(`--out-format=github-actions,${formats}`); + } + } + else { + addedArgs.push(`--out-format=github-actions`); } - addedArgs.push(`--out-format=github-actions`); if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { throw new Error(`please, don't specify manually --new* args when requesting only new issues`); diff --git a/src/run.ts b/src/run.ts index 2fd55d5..0c7e9a3 100644 --- a/src/run.ts +++ b/src/run.ts @@ -119,18 +119,27 @@ async function runLint(lintPath: string, patchPath: string): Promise { const userArgs = core.getInput(`args`) const addedArgs: string[] = [] - const userArgNames = new Set( - userArgs - .trim() - .split(/\s+/) - .map((arg) => arg.split(`=`)[0]) - .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`) + const userArgsList = userArgs + .trim() + .split(/\s+/) + .filter((arg) => arg.startsWith(`-`)) + .map((arg) => arg.replace(/^-+/, ``)) + .map((arg) => arg.split(/=(.*)/, 2)) + .map<[string, string]>(([key, value]) => [key, value ?? '']) + + const userArgsMap = new Map(userArgsList) + const userArgNames = new Set(userArgsList.map(([key, value]) => key)); + + const formats = userArgsMap.get('out-format') + if (formats) { + if (formats.includes('github-actions')) { + addedArgs.push(`--out-format=${formats}`); + } else { + addedArgs.push(`--out-format=github-actions,${formats}`) + } + } else { + addedArgs.push(`--out-format=github-actions`) } - addedArgs.push(`--out-format=github-actions`) if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {