mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-16 07:28:27 +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."
|
||||
default: false
|
||||
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:
|
||||
using: "node12"
|
||||
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.
|
||||
printOutput(exc);
|
||||
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`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
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.
|
||||
printOutput(exc);
|
||||
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`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.setFailed(`golangci-lint exit with code ${exc.code}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,13 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||
printOutput(exc)
|
||||
|
||||
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`)
|
||||
}
|
||||
} else {
|
||||
core.setFailed(`golangci-lint exit with code ${exc.code}`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue