Skip to content

Commit

Permalink
don't add --new args if not requested
Browse files Browse the repository at this point in the history
  • Loading branch information
jirfag committed May 22, 2020
1 parent 10cbc92 commit 04eca20
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
16 changes: 9 additions & 7 deletions dist/post_run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions dist/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
18 changes: 10 additions & 8 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,16 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
}
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 = {}
Expand All @@ -160,7 +162,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
}

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)
Expand Down

0 comments on commit 04eca20

Please sign in to comment.