Skip to content

Commit 9ec44b9

Browse files
committed
feat: option to use the matchers file inside the Official GitHub Action
1 parent a6711f9 commit 9ec44b9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/printers/githubaction_problem_matchers.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io"
77
"os"
88
"path/filepath"
9+
"strconv"
910

1011
"github.com/golangci/golangci-lint/pkg/result"
1112
)
@@ -85,7 +86,12 @@ func (p *GitHubActionProblemMatchers) Print(issues []result.Issue) error {
8586

8687
_, _ = fmt.Fprintln(p.w, "::debug::problem matcher definition file: "+filename)
8788

88-
_, _ = fmt.Fprintln(p.w, "::add-matcher::"+filename)
89+
// Used by the official GitHub Action (https://github.com/golangci/golangci-lint-action).
90+
// The problem matchers is embedded inside the GitHub Action to avoid errors:
91+
// https://github.com/golangci/golangci-lint/issues/4695
92+
if ok, _ := strconv.ParseBool(os.Getenv("GOLANGCI_LINT_SKIP_GHA_PM_INSTALL")); !ok {
93+
_, _ = fmt.Fprintln(p.w, "::add-matcher::"+filename)
94+
}
8995

9096
for ind := range issues {
9197
_, err := fmt.Fprintln(p.w, formatIssueAsProblemMatcher(&issues[ind]))

0 commit comments

Comments
 (0)