Skip to content

Commit

Permalink
feat: add an option to disable problem matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 6, 2024
1 parent 38e1018 commit 15a076e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
9 changes: 7 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,17 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
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}`)
Expand Down

0 comments on commit 15a076e

Please sign in to comment.