mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-16 15:38:28 +00:00
Do not fail on only Warnings.
This commit is contained in:
parent
e3c53feccf
commit
168c94fc3c
4 changed files with 27 additions and 3 deletions
|
|
@ -32,6 +32,10 @@ inputs:
|
||||||
description: "if set to true then the action don't cache or restore ~/.cache/go-build."
|
description: "if set to true then the action don't cache or restore ~/.cache/go-build."
|
||||||
default: false
|
default: false
|
||||||
required: true
|
required: true
|
||||||
|
allow-warnings:
|
||||||
|
description: "if set to true then the action don't fail with just golangci-lint warnings."
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node12"
|
||||||
main: "dist/run/index.js"
|
main: "dist/run/index.js"
|
||||||
|
|
|
||||||
7
dist/post_run/index.js
vendored
7
dist/post_run/index.js
vendored
|
|
@ -6860,8 +6860,15 @@ function runLint(lintPath, patchPath) {
|
||||||
// TODO: support reviewdog or leaving comments by GitHub API.
|
// TODO: support reviewdog or leaving comments by GitHub API.
|
||||||
printOutput(exc);
|
printOutput(exc);
|
||||||
if (exc.code === 1) {
|
if (exc.code === 1) {
|
||||||
|
const allowWarnings = core.getInput(`allow-warnings`, { required: true }).trim();
|
||||||
|
const errorRegex = /^::error.+$/m;
|
||||||
|
if (allowWarnings.toLowerCase() == "true" && !exc.stdout.match(errorRegex)) {
|
||||||
|
core.info(`golangci-lint found no errors`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
core.setFailed(`issues found`);
|
core.setFailed(`issues found`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
core.setFailed(`golangci-lint exit with code ${exc.code}`);
|
core.setFailed(`golangci-lint exit with code ${exc.code}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
dist/run/index.js
vendored
7
dist/run/index.js
vendored
|
|
@ -6870,8 +6870,15 @@ function runLint(lintPath, patchPath) {
|
||||||
// TODO: support reviewdog or leaving comments by GitHub API.
|
// TODO: support reviewdog or leaving comments by GitHub API.
|
||||||
printOutput(exc);
|
printOutput(exc);
|
||||||
if (exc.code === 1) {
|
if (exc.code === 1) {
|
||||||
|
const allowWarnings = core.getInput(`allow-warnings`, { required: true }).trim();
|
||||||
|
const errorRegex = /^::error.+$/m;
|
||||||
|
if (allowWarnings.toLowerCase() == "true" && !exc.stdout.match(errorRegex)) {
|
||||||
|
core.info(`golangci-lint found no errors`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
core.setFailed(`issues found`);
|
core.setFailed(`issues found`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
core.setFailed(`golangci-lint exit with code ${exc.code}`);
|
core.setFailed(`golangci-lint exit with code ${exc.code}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,13 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||||
printOutput(exc)
|
printOutput(exc)
|
||||||
|
|
||||||
if (exc.code === 1) {
|
if (exc.code === 1) {
|
||||||
|
const allowWarnings = core.getInput(`allow-warnings`, { required: true }).trim()
|
||||||
|
const errorRegex = /^::error.+$/m
|
||||||
|
if (allowWarnings.toLowerCase() == "true" && !exc.stdout.match(errorRegex)) {
|
||||||
|
core.info(`golangci-lint found no errors`)
|
||||||
|
} else {
|
||||||
core.setFailed(`issues found`)
|
core.setFailed(`issues found`)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
core.setFailed(`golangci-lint exit with code ${exc.code}`)
|
core.setFailed(`golangci-lint exit with code ${exc.code}`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue