feat: support out-format as args (#769)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
185e7a2f8f
commit
322510a3ea
21
dist/post_run/index.js
vendored
21
dist/post_run/index.js
vendored
@ -66639,16 +66639,23 @@ function runLint(lintPath, patchPath) {
|
|||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set(userArgs
|
const userArgsList = userArgs
|
||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.map((arg) => arg.replace(/^-+/, ``)));
|
.map((arg) => arg.replace(/^-+/, ``))
|
||||||
if (userArgNames.has(`out-format`)) {
|
.map((arg) => arg.split(/=(.*)/, 2))
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
.map(([key, value]) => [key.toLowerCase(), value !== null && value !== void 0 ? value : ""]);
|
||||||
}
|
const userArgsMap = new Map(userArgsList);
|
||||||
addedArgs.push(`--out-format=github-actions`);
|
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||||
|
const formats = (userArgsMap.get("out-format") || "")
|
||||||
|
.trim()
|
||||||
|
.split(",")
|
||||||
|
.filter((f) => f.length > 0)
|
||||||
|
.filter((f) => !f.startsWith(`github-actions`))
|
||||||
|
.concat("github-actions")
|
||||||
|
.join(",");
|
||||||
|
addedArgs.push(`--out-format=${formats}`);
|
||||||
if (patchPath) {
|
if (patchPath) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
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`);
|
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||||
|
21
dist/run/index.js
vendored
21
dist/run/index.js
vendored
@ -66639,16 +66639,23 @@ function runLint(lintPath, patchPath) {
|
|||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set(userArgs
|
const userArgsList = userArgs
|
||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.map((arg) => arg.replace(/^-+/, ``)));
|
.map((arg) => arg.replace(/^-+/, ``))
|
||||||
if (userArgNames.has(`out-format`)) {
|
.map((arg) => arg.split(/=(.*)/, 2))
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
.map(([key, value]) => [key.toLowerCase(), value !== null && value !== void 0 ? value : ""]);
|
||||||
}
|
const userArgsMap = new Map(userArgsList);
|
||||||
addedArgs.push(`--out-format=github-actions`);
|
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||||
|
const formats = (userArgsMap.get("out-format") || "")
|
||||||
|
.trim()
|
||||||
|
.split(",")
|
||||||
|
.filter((f) => f.length > 0)
|
||||||
|
.filter((f) => !f.startsWith(`github-actions`))
|
||||||
|
.concat("github-actions")
|
||||||
|
.join(",");
|
||||||
|
addedArgs.push(`--out-format=${formats}`);
|
||||||
if (patchPath) {
|
if (patchPath) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
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`);
|
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||||
|
24
src/run.ts
24
src/run.ts
@ -121,18 +121,26 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||||||
const userArgs = core.getInput(`args`)
|
const userArgs = core.getInput(`args`)
|
||||||
const addedArgs: string[] = []
|
const addedArgs: string[] = []
|
||||||
|
|
||||||
const userArgNames = new Set<string>(
|
const userArgsList = userArgs
|
||||||
userArgs
|
|
||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.map((arg) => arg.replace(/^-+/, ``))
|
.map((arg) => arg.replace(/^-+/, ``))
|
||||||
)
|
.map((arg) => arg.split(/=(.*)/, 2))
|
||||||
if (userArgNames.has(`out-format`)) {
|
.map<[string, string]>(([key, value]) => [key.toLowerCase(), value ?? ""])
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
|
||||||
}
|
const userArgsMap = new Map<string, string>(userArgsList)
|
||||||
addedArgs.push(`--out-format=github-actions`)
|
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
|
||||||
|
|
||||||
|
const formats = (userArgsMap.get("out-format") || "")
|
||||||
|
.trim()
|
||||||
|
.split(",")
|
||||||
|
.filter((f) => f.length > 0)
|
||||||
|
.filter((f) => !f.startsWith(`github-actions`))
|
||||||
|
.concat("github-actions")
|
||||||
|
.join(",")
|
||||||
|
|
||||||
|
addedArgs.push(`--out-format=${formats}`)
|
||||||
|
|
||||||
if (patchPath) {
|
if (patchPath) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user