feat: add option to enable/disable annotations
This commit is contained in:
parent
2bff406277
commit
aebff4bd9c
12
README.md
12
README.md
@ -163,6 +163,18 @@ with:
|
||||
# ...
|
||||
```
|
||||
|
||||
`annotations`: (optional) To enable/disable GitHub Action annotations.
|
||||
If disabled (`false`), the output format(s) will follow the golangci-lint configuration file and use the same default as golangci-lint (i.e. `colored-line-number`).
|
||||
https://golangci-lint.run/usage/configuration/#output-configuration
|
||||
The default value is `true`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
with:
|
||||
annotations: false
|
||||
# ...
|
||||
```
|
||||
|
||||
`args`: (optional) golangci-lint command line arguments.
|
||||
Note: By default, the `.golangci.yml` file should be at the root of the repository.
|
||||
The location of the configuration file can be changed by using `--config=`
|
||||
|
@ -35,6 +35,10 @@ inputs:
|
||||
restore existing caches, subject to other options.
|
||||
default: 'false'
|
||||
required: false
|
||||
annotations:
|
||||
description: "To Enable/disable GitHub Action annotations"
|
||||
default: 'true'
|
||||
required: false
|
||||
args:
|
||||
description: "golangci-lint command line arguments"
|
||||
default: ""
|
||||
|
21
dist/post_run/index.js
generated
vendored
21
dist/post_run/index.js
generated
vendored
@ -89287,15 +89287,18 @@ async function runLint(lintPath, patchPath) {
|
||||
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
||||
const userArgsMap = new Map(userArgsList);
|
||||
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",");
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
const annotations = core.getInput(`annotations`).trim() !== "false";
|
||||
if (annotations) {
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",");
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
}
|
||||
if (isOnlyNewIssues()) {
|
||||
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`);
|
||||
|
21
dist/run/index.js
generated
vendored
21
dist/run/index.js
generated
vendored
@ -89287,15 +89287,18 @@ async function runLint(lintPath, patchPath) {
|
||||
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
||||
const userArgsMap = new Map(userArgsList);
|
||||
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",");
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
const annotations = core.getInput(`annotations`).trim() !== "false";
|
||||
if (annotations) {
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",");
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
}
|
||||
if (isOnlyNewIssues()) {
|
||||
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`);
|
||||
|
22
src/run.ts
22
src/run.ts
@ -192,16 +192,20 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||
const userArgsMap = new Map<string, string>(userArgsList)
|
||||
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
|
||||
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",")
|
||||
const annotations = core.getInput(`annotations`).trim() !== "false"
|
||||
|
||||
addedArgs.push(`--out-format=${formats}`)
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
||||
if (annotations) {
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",")
|
||||
|
||||
addedArgs.push(`--out-format=${formats}`)
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
||||
}
|
||||
|
||||
if (isOnlyNewIssues()) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user