Skip to content

Commit 04eca20

Browse files
committed
don't add --new args if not requested
1 parent 10cbc92 commit 04eca20

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

dist/post_run/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6647,13 +6647,15 @@ function runLint(lintPath, patchPath) {
66476647
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
66486648
}
66496649
addedArgs.push(`--out-format=github-actions`);
6650-
if (patchPath && (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`))) {
6651-
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
6650+
if (patchPath) {
6651+
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
6652+
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
6653+
}
6654+
addedArgs.push(`--new-from-patch=${patchPath}`);
6655+
// Override config values.
6656+
addedArgs.push(`--new=false`);
6657+
addedArgs.push(`--new-from-rev=`);
66526658
}
6653-
addedArgs.push(`--new-from-patch=${patchPath}`);
6654-
// Override config values.
6655-
addedArgs.push(`--new=false`);
6656-
addedArgs.push(`--new-from-rev=`);
66576659
const workingDirectory = core.getInput(`working-directory`);
66586660
const cmdArgs = {};
66596661
if (workingDirectory) {
@@ -6667,7 +6669,7 @@ function runLint(lintPath, patchPath) {
66676669
cmdArgs.cwd = path.resolve(workingDirectory);
66686670
}
66696671
const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight();
6670-
core.info(`Running [${cmd}] in [${cmdArgs.cwd}] ...`);
6672+
core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`);
66716673
const startedAt = Date.now();
66726674
try {
66736675
const res = yield execShellCommand(cmd, cmdArgs);

dist/run/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6659,13 +6659,15 @@ function runLint(lintPath, patchPath) {
66596659
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
66606660
}
66616661
addedArgs.push(`--out-format=github-actions`);
6662-
if (patchPath && (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`))) {
6663-
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
6662+
if (patchPath) {
6663+
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
6664+
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
6665+
}
6666+
addedArgs.push(`--new-from-patch=${patchPath}`);
6667+
// Override config values.
6668+
addedArgs.push(`--new=false`);
6669+
addedArgs.push(`--new-from-rev=`);
66646670
}
6665-
addedArgs.push(`--new-from-patch=${patchPath}`);
6666-
// Override config values.
6667-
addedArgs.push(`--new=false`);
6668-
addedArgs.push(`--new-from-rev=`);
66696671
const workingDirectory = core.getInput(`working-directory`);
66706672
const cmdArgs = {};
66716673
if (workingDirectory) {
@@ -6679,7 +6681,7 @@ function runLint(lintPath, patchPath) {
66796681
cmdArgs.cwd = path.resolve(workingDirectory);
66806682
}
66816683
const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight();
6682-
core.info(`Running [${cmd}] in [${cmdArgs.cwd}] ...`);
6684+
core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`);
66836685
const startedAt = Date.now();
66846686
try {
66856687
const res = yield execShellCommand(cmd, cmdArgs);

src/run.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,16 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
136136
}
137137
addedArgs.push(`--out-format=github-actions`)
138138

139-
if (patchPath && (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`))) {
140-
throw new Error(`please, don't specify manually --new* args when requesting only new issues`)
141-
}
142-
addedArgs.push(`--new-from-patch=${patchPath}`)
139+
if (patchPath) {
140+
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
141+
throw new Error(`please, don't specify manually --new* args when requesting only new issues`)
142+
}
143+
addedArgs.push(`--new-from-patch=${patchPath}`)
143144

144-
// Override config values.
145-
addedArgs.push(`--new=false`)
146-
addedArgs.push(`--new-from-rev=`)
145+
// Override config values.
146+
addedArgs.push(`--new=false`)
147+
addedArgs.push(`--new-from-rev=`)
148+
}
147149

148150
const workingDirectory = core.getInput(`working-directory`)
149151
const cmdArgs: ExecOptions = {}
@@ -160,7 +162,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
160162
}
161163

162164
const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight()
163-
core.info(`Running [${cmd}] in [${cmdArgs.cwd}] ...`)
165+
core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`)
164166
const startedAt = Date.now()
165167
try {
166168
const res = await execShellCommand(cmd, cmdArgs)

0 commit comments

Comments
 (0)