From 7d26dd30b9206a8bae518929cf6a7dab4efff7fd Mon Sep 17 00:00:00 2001 From: Florian Gessner Date: Sun, 22 May 2022 10:20:12 +0200 Subject: [PATCH 1/4] Add option to configure additional output format --- README.md | 6 ++++++ action.yml | 3 +++ src/run.ts | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f1a3a1016..ae381df715 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,9 @@ jobs: # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true + # Optional: render results of golangci-lint additionally into a file; syntax: : (see also https://golangci-lint.run/usage/configuration/#output-configuration) + # output-file: checkstyle:golangci_lint.xml + # Optional: if set to true then the all caching functionality will be complete disabled, # takes precedence over all other caching options. # skip-cache: true @@ -115,6 +118,9 @@ jobs: # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true + + # Optional: render results of golangci-lint additionally into a file; syntax: : (see also https://golangci-lint.run/usage/configuration/#output-configuration) + # output-file: checkstyle:golangci_lint.xml ``` You will also likely need to add the following `.gitattributes` file to ensure that line endings for windows builds are properly formatted: diff --git a/action.yml b/action.yml index 45e757b365..a6757cb5a6 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: description: "if set to true and the action runs on a pull request - the action outputs only newly found issues" default: false required: true + output-file: + description: "render results of golangci-lint additionally into a file; syntax: : (see also https://golangci-lint.run/usage/configuration/#output-configuration)" + required: false skip-cache: description: | if set to true then the all caching functionality will be complete disabled, diff --git a/src/run.ts b/src/run.ts index 2fd55d51ce..4247846625 100644 --- a/src/run.ts +++ b/src/run.ts @@ -130,7 +130,9 @@ async function runLint(lintPath: string, patchPath: string): Promise { if (userArgNames.has(`out-format`)) { throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`) } - addedArgs.push(`--out-format=github-actions`) + + const outputFile = core.getInput(`output-file`, { required: false }).trim() + addedArgs.push(`--out-format=github-actions${outputFile ? ',' + outputFile : ''}`) if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { From 00d2fbba7acd82b8ff9d960def73f7468e97b7c4 Mon Sep 17 00:00:00 2001 From: Florian Gessner Date: Sun, 22 May 2022 10:22:30 +0200 Subject: [PATCH 2/4] ignore webstorm ide files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 4fde6da638..31fb313bcf 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,6 @@ typings/ # Text editor files .vscode/ + +# IntelliJ/WebStorm files +.idea From 86bb75a02452e1e63a1166e7092c48eb8ec98ae5 Mon Sep 17 00:00:00 2001 From: Florian Gessner Date: Sun, 22 May 2022 10:26:47 +0200 Subject: [PATCH 3/4] fix format --- src/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/run.ts b/src/run.ts index 4247846625..ac19a6a1ad 100644 --- a/src/run.ts +++ b/src/run.ts @@ -132,7 +132,7 @@ async function runLint(lintPath: string, patchPath: string): Promise { } const outputFile = core.getInput(`output-file`, { required: false }).trim() - addedArgs.push(`--out-format=github-actions${outputFile ? ',' + outputFile : ''}`) + addedArgs.push(`--out-format=github-actions${outputFile ? "," + outputFile : ""}`) if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { From a8cbf3c997e4551224c68178a5161201a204dc37 Mon Sep 17 00:00:00 2001 From: Florian Gessner Date: Sun, 22 May 2022 10:39:24 +0200 Subject: [PATCH 4/4] add distribution files --- dist/post_run/index.js | 3 ++- dist/run/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index d9d10104af..2f06e9eb2b 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -68277,7 +68277,8 @@ function runLint(lintPath, patchPath) { if (userArgNames.has(`out-format`)) { throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`); } - addedArgs.push(`--out-format=github-actions`); + const outputFile = core.getInput(`output-file`, { required: false }).trim(); + addedArgs.push(`--out-format=github-actions${outputFile ? "," + outputFile : ""}`); if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { throw new Error(`please, don't specify manually --new* args when requesting only new issues`); diff --git a/dist/run/index.js b/dist/run/index.js index ff0df9a476..d39fda7bc4 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -68277,7 +68277,8 @@ function runLint(lintPath, patchPath) { if (userArgNames.has(`out-format`)) { throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`); } - addedArgs.push(`--out-format=github-actions`); + const outputFile = core.getInput(`output-file`, { required: false }).trim(); + addedArgs.push(`--out-format=github-actions${outputFile ? "," + outputFile : ""}`); if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { throw new Error(`please, don't specify manually --new* args when requesting only new issues`);