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.
|
`args`: (optional) golangci-lint command line arguments.
|
||||||
Note: By default, the `.golangci.yml` file should be at the root of the repository.
|
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=`
|
The location of the configuration file can be changed by using `--config=`
|
||||||
|
@ -35,6 +35,10 @@ inputs:
|
|||||||
restore existing caches, subject to other options.
|
restore existing caches, subject to other options.
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
|
annotations:
|
||||||
|
description: "To Enable/disable GitHub Action annotations"
|
||||||
|
default: 'true'
|
||||||
|
required: false
|
||||||
args:
|
args:
|
||||||
description: "golangci-lint command line arguments"
|
description: "golangci-lint command line arguments"
|
||||||
default: ""
|
default: ""
|
||||||
|
3
dist/post_run/index.js
generated
vendored
3
dist/post_run/index.js
generated
vendored
@ -89287,6 +89287,8 @@ async function runLint(lintPath, patchPath) {
|
|||||||
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
||||||
const userArgsMap = new Map(userArgsList);
|
const userArgsMap = new Map(userArgsList);
|
||||||
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||||
|
const annotations = core.getInput(`annotations`).trim() !== "false";
|
||||||
|
if (annotations) {
|
||||||
const formats = (userArgsMap.get("out-format") || "")
|
const formats = (userArgsMap.get("out-format") || "")
|
||||||
.trim()
|
.trim()
|
||||||
.split(",")
|
.split(",")
|
||||||
@ -89296,6 +89298,7 @@ async function runLint(lintPath, patchPath) {
|
|||||||
.join(",");
|
.join(",");
|
||||||
addedArgs.push(`--out-format=${formats}`);
|
addedArgs.push(`--out-format=${formats}`);
|
||||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||||
|
}
|
||||||
if (isOnlyNewIssues()) {
|
if (isOnlyNewIssues()) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
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`);
|
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||||
|
3
dist/run/index.js
generated
vendored
3
dist/run/index.js
generated
vendored
@ -89287,6 +89287,8 @@ async function runLint(lintPath, patchPath) {
|
|||||||
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
||||||
const userArgsMap = new Map(userArgsList);
|
const userArgsMap = new Map(userArgsList);
|
||||||
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||||
|
const annotations = core.getInput(`annotations`).trim() !== "false";
|
||||||
|
if (annotations) {
|
||||||
const formats = (userArgsMap.get("out-format") || "")
|
const formats = (userArgsMap.get("out-format") || "")
|
||||||
.trim()
|
.trim()
|
||||||
.split(",")
|
.split(",")
|
||||||
@ -89296,6 +89298,7 @@ async function runLint(lintPath, patchPath) {
|
|||||||
.join(",");
|
.join(",");
|
||||||
addedArgs.push(`--out-format=${formats}`);
|
addedArgs.push(`--out-format=${formats}`);
|
||||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||||
|
}
|
||||||
if (isOnlyNewIssues()) {
|
if (isOnlyNewIssues()) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
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`);
|
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||||
|
@ -192,6 +192,9 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||||||
const userArgsMap = new Map<string, string>(userArgsList)
|
const userArgsMap = new Map<string, string>(userArgsList)
|
||||||
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
|
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
|
||||||
|
|
||||||
|
const annotations = core.getInput(`annotations`).trim() !== "false"
|
||||||
|
|
||||||
|
if (annotations) {
|
||||||
const formats = (userArgsMap.get("out-format") || "")
|
const formats = (userArgsMap.get("out-format") || "")
|
||||||
.trim()
|
.trim()
|
||||||
.split(",")
|
.split(",")
|
||||||
@ -202,6 +205,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||||||
|
|
||||||
addedArgs.push(`--out-format=${formats}`)
|
addedArgs.push(`--out-format=${formats}`)
|
||||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
||||||
|
}
|
||||||
|
|
||||||
if (isOnlyNewIssues()) {
|
if (isOnlyNewIssues()) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user