From 04eca2038305127fb1e6683425b6864cd5612f2d Mon Sep 17 00:00:00 2001 From: Denis Isaev Date: Fri, 22 May 2020 10:48:00 +0300 Subject: [PATCH] don't add --new args if not requested --- dist/post_run/index.js | 16 +++++++++------- dist/run/index.js | 16 +++++++++------- src/run.ts | 18 ++++++++++-------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 809ad740e7..b7efc19776 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -6647,13 +6647,15 @@ function runLint(lintPath, patchPath) { throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`); } addedArgs.push(`--out-format=github-actions`); - if (patchPath && (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`); + 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`); + } + addedArgs.push(`--new-from-patch=${patchPath}`); + // Override config values. + addedArgs.push(`--new=false`); + addedArgs.push(`--new-from-rev=`); } - addedArgs.push(`--new-from-patch=${patchPath}`); - // Override config values. - addedArgs.push(`--new=false`); - addedArgs.push(`--new-from-rev=`); const workingDirectory = core.getInput(`working-directory`); const cmdArgs = {}; if (workingDirectory) { @@ -6667,7 +6669,7 @@ function runLint(lintPath, patchPath) { cmdArgs.cwd = path.resolve(workingDirectory); } const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight(); - core.info(`Running [${cmd}] in [${cmdArgs.cwd}] ...`); + core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`); const startedAt = Date.now(); try { const res = yield execShellCommand(cmd, cmdArgs); diff --git a/dist/run/index.js b/dist/run/index.js index 174d6d070c..4cd0ebc04b 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -6659,13 +6659,15 @@ function runLint(lintPath, patchPath) { throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`); } addedArgs.push(`--out-format=github-actions`); - if (patchPath && (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`); + 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`); + } + addedArgs.push(`--new-from-patch=${patchPath}`); + // Override config values. + addedArgs.push(`--new=false`); + addedArgs.push(`--new-from-rev=`); } - addedArgs.push(`--new-from-patch=${patchPath}`); - // Override config values. - addedArgs.push(`--new=false`); - addedArgs.push(`--new-from-rev=`); const workingDirectory = core.getInput(`working-directory`); const cmdArgs = {}; if (workingDirectory) { @@ -6679,7 +6681,7 @@ function runLint(lintPath, patchPath) { cmdArgs.cwd = path.resolve(workingDirectory); } const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight(); - core.info(`Running [${cmd}] in [${cmdArgs.cwd}] ...`); + core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`); const startedAt = Date.now(); try { const res = yield execShellCommand(cmd, cmdArgs); diff --git a/src/run.ts b/src/run.ts index f26c914b02..d334db0e9e 100644 --- a/src/run.ts +++ b/src/run.ts @@ -136,14 +136,16 @@ async function runLint(lintPath: string, patchPath: string): Promise { } addedArgs.push(`--out-format=github-actions`) - if (patchPath && (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`) - } - addedArgs.push(`--new-from-patch=${patchPath}`) + 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`) + } + addedArgs.push(`--new-from-patch=${patchPath}`) - // Override config values. - addedArgs.push(`--new=false`) - addedArgs.push(`--new-from-rev=`) + // Override config values. + addedArgs.push(`--new=false`) + addedArgs.push(`--new-from-rev=`) + } const workingDirectory = core.getInput(`working-directory`) const cmdArgs: ExecOptions = {} @@ -160,7 +162,7 @@ async function runLint(lintPath: string, patchPath: string): Promise { } const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight() - core.info(`Running [${cmd}] in [${cmdArgs.cwd}] ...`) + core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`) const startedAt = Date.now() try { const res = await execShellCommand(cmd, cmdArgs)