diff --git a/README.md b/README.md index 5e498a32a7..5bba0d8b2b 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,23 @@ with: # ... ``` +### `problem-matchers` + +(optional) + +To enable/disable GitHub Action annotations problem matchers (requires `annotations: true`. + +The problem matchers allows the display file information (path, position) inside the logs. + +The default value is `true`. + +```yml +uses: golangci/golangci-lint-action@v5 +with: + problem-matchers: false + # ... +``` + ### `args` (optional) diff --git a/action.yml b/action.yml index bb4a50870e..4a35def87d 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,10 @@ inputs: description: "To Enable/disable GitHub Action annotations" default: 'true' required: false + problem-matchers: + description: "To Enable/disable GitHub Action annotations problem matchers" + default: 'true' + required: false args: description: "golangci-lint command line arguments" default: "" diff --git a/src/run.ts b/src/run.ts index 9cffa9c690..e0d0114877 100644 --- a/src/run.ts +++ b/src/run.ts @@ -188,12 +188,17 @@ async function runLint(lintPath: string, patchPath: string): Promise { const annotations = core.getBooleanInput(`annotations`) if (annotations) { + let ghaFormat = `github-actions-problem-matchers` + if (!core.getBooleanInput(`problem-matchers`)) { + ghaFormat = `github-actions` + } + const formats = (userArgsMap.get("out-format") || "") .trim() .split(",") .filter((f) => f.length > 0) - .filter((f) => !f.startsWith(`github-actions`)) - .concat("github-actions") + .filter((f) => !f.startsWith(ghaFormat)) + .concat(ghaFormat) .join(",") addedArgs.push(`--out-format=${formats}`)