Skip to content

Add support to configure additional output format #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ typings/

# Text editor files
.vscode/

# IntelliJ/WebStorm files
.idea
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <format>:<file_path> (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
Expand Down Expand Up @@ -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: <format>:<file_path> (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:
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <format>:<file_path> (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,
Expand Down
3 changes: 2 additions & 1 deletion dist/post_run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
3 changes: 2 additions & 1 deletion dist/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
4 changes: 3 additions & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
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`)) {
Expand Down