mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-02-25 00:51:49 +00:00
build
This commit is contained in:
parent
74044faec7
commit
7b740943db
3 changed files with 42 additions and 10 deletions
22
dist/post_run/index.js
generated
vendored
22
dist/post_run/index.js
generated
vendored
|
|
@ -90897,12 +90897,27 @@ async function prepareEnv() {
|
||||||
core.info(`Prepared env in ${Date.now() - startedAt}ms`);
|
core.info(`Prepared env in ${Date.now() - startedAt}ms`);
|
||||||
return { lintPath, patchPath };
|
return { lintPath, patchPath };
|
||||||
}
|
}
|
||||||
|
const printOutputAndForwardJSON = (s) => {
|
||||||
|
const lines = s.split(`\n`).filter((line) => line.length > 0);
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith(`::`)) {
|
||||||
|
core.info(line);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const obj = JSON.parse(line);
|
||||||
|
core.setOutput("JSON", JSON.stringify(obj, null, 2));
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.info(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
const printOutput = (res) => {
|
const printOutput = (res) => {
|
||||||
if (res.stdout) {
|
if (res.stdout) {
|
||||||
core.info(res.stdout);
|
printOutputAndForwardJSON(res.stdout);
|
||||||
}
|
}
|
||||||
if (res.stderr) {
|
if (res.stderr) {
|
||||||
core.info(res.stderr);
|
printOutputAndForwardJSON(res.stderr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
async function runLint(lintPath, patchPath) {
|
async function runLint(lintPath, patchPath) {
|
||||||
|
|
@ -90926,8 +90941,9 @@ async function runLint(lintPath, patchPath) {
|
||||||
.trim()
|
.trim()
|
||||||
.split(",")
|
.split(",")
|
||||||
.filter((f) => f.length > 0)
|
.filter((f) => f.length > 0)
|
||||||
.filter((f) => !f.startsWith(`github-actions`))
|
.filter((f) => !f.startsWith(`github-actions`) && !f.startsWith(`json`))
|
||||||
.concat("github-actions")
|
.concat("github-actions")
|
||||||
|
.concat("json")
|
||||||
.join(",");
|
.join(",");
|
||||||
addedArgs.push(`--out-format=${formats}`);
|
addedArgs.push(`--out-format=${formats}`);
|
||||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||||
|
|
|
||||||
22
dist/run/index.js
generated
vendored
22
dist/run/index.js
generated
vendored
|
|
@ -90897,12 +90897,27 @@ async function prepareEnv() {
|
||||||
core.info(`Prepared env in ${Date.now() - startedAt}ms`);
|
core.info(`Prepared env in ${Date.now() - startedAt}ms`);
|
||||||
return { lintPath, patchPath };
|
return { lintPath, patchPath };
|
||||||
}
|
}
|
||||||
|
const printOutputAndForwardJSON = (s) => {
|
||||||
|
const lines = s.split(`\n`).filter((line) => line.length > 0);
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith(`::`)) {
|
||||||
|
core.info(line);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const obj = JSON.parse(line);
|
||||||
|
core.setOutput("JSON", JSON.stringify(obj, null, 2));
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.info(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
const printOutput = (res) => {
|
const printOutput = (res) => {
|
||||||
if (res.stdout) {
|
if (res.stdout) {
|
||||||
core.info(res.stdout);
|
printOutputAndForwardJSON(res.stdout);
|
||||||
}
|
}
|
||||||
if (res.stderr) {
|
if (res.stderr) {
|
||||||
core.info(res.stderr);
|
printOutputAndForwardJSON(res.stderr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
async function runLint(lintPath, patchPath) {
|
async function runLint(lintPath, patchPath) {
|
||||||
|
|
@ -90926,8 +90941,9 @@ async function runLint(lintPath, patchPath) {
|
||||||
.trim()
|
.trim()
|
||||||
.split(",")
|
.split(",")
|
||||||
.filter((f) => f.length > 0)
|
.filter((f) => f.length > 0)
|
||||||
.filter((f) => !f.startsWith(`github-actions`))
|
.filter((f) => !f.startsWith(`github-actions`) && !f.startsWith(`json`))
|
||||||
.concat("github-actions")
|
.concat("github-actions")
|
||||||
|
.concat("json")
|
||||||
.join(",");
|
.join(",");
|
||||||
addedArgs.push(`--out-format=${formats}`);
|
addedArgs.push(`--out-format=${formats}`);
|
||||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ type ExecRes = {
|
||||||
stderr: string
|
stderr: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const printJSONLines = (s: string): void => {
|
const printOutputAndForwardJSON = (s: string): void => {
|
||||||
const lines = s.split(`\n`).filter((line) => line.length > 0)
|
const lines = s.split(`\n`).filter((line) => line.length > 0)
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.startsWith(`::`)) {
|
if (line.startsWith(`::`)) {
|
||||||
|
|
@ -112,7 +112,7 @@ const printJSONLines = (s: string): void => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const obj = JSON.parse(line)
|
const obj = JSON.parse(line)
|
||||||
core.setOutput('json', JSON.stringify(obj, null, 2))
|
core.setOutput("JSON", JSON.stringify(obj, null, 2))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.info(line)
|
core.info(line)
|
||||||
}
|
}
|
||||||
|
|
@ -121,10 +121,10 @@ const printJSONLines = (s: string): void => {
|
||||||
|
|
||||||
const printOutput = (res: ExecRes): void => {
|
const printOutput = (res: ExecRes): void => {
|
||||||
if (res.stdout) {
|
if (res.stdout) {
|
||||||
printJSONLines(res.stdout)
|
printOutputAndForwardJSON(res.stdout)
|
||||||
}
|
}
|
||||||
if (res.stderr) {
|
if (res.stderr) {
|
||||||
printJSONLines(res.stderr)
|
printOutputAndForwardJSON(res.stderr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue