Skip to content

Commit f3ae99f

Browse files
authored
docs: organize options (#1314)
1 parent 1dfda28 commit f3ae99f

File tree

3 files changed

+80
-48
lines changed

3 files changed

+80
-48
lines changed

README.md

Lines changed: 64 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,26 @@ You will also likely need to add the following `.gitattributes` file to ensure t
259259

260260
## Options
261261

262-
### `version`
262+
### Overview
263+
264+
| Option | Description |
265+
|---------------------------------------------------------------|----------------------------------------------------|
266+
| [`version`](#version) | The version of golangci-lint to use. |
267+
| [`install-mode`](#install-mode) | The mode to install golangci-lint. |
268+
| [`install-only`](#install-only) | Only install golangci-lint. |
269+
| [`verify`](#verify) | Validates golangci-lint configuration file. |
270+
| [`github-token`](#github-token) | Used by the `only-new-issues` option. |
271+
| [`only-new-issues`](#only-new-issues) | Show only new issues. |
272+
| [`working-directory`](#working-directory) | The golangci-lint working directory. |
273+
| [`args`](#args) | Golangci-lint command line arguments. |
274+
| [`skip-cache`](#skip-cache) | Disable cache support. |
275+
| [`skip-save-cache`](#skip-save-cache) | Don't save cache. |
276+
| [`cache-invalidation-interval`](#cache-invalidation-interval) | Number of days before cache invalidation. |
277+
| [`problem-matchers`](#problem-matchers) | Forces the usage of the embedded problem matchers. |
278+
279+
### Installation
280+
281+
#### `version`
263282

264283
(optional)
265284

@@ -282,7 +301,7 @@ with:
282301

283302
</details>
284303

285-
### `install-mode`
304+
#### `install-mode`
286305

287306
(optional)
288307

@@ -304,7 +323,7 @@ with:
304323

305324
</details>
306325

307-
### `install-only`
326+
#### `install-only`
308327

309328
(optional)
310329

@@ -325,50 +344,52 @@ with:
325344

326345
</details>
327346

328-
### `github-token`
347+
### Run
348+
349+
#### `verify`
329350

330351
(optional)
331352

332-
When using the `only-new-issues` option, the GitHub API is used, so a token is required.
353+
This option is `true` by default.
333354

334-
By default, it uses the `github.token` from the action.
355+
If the GitHub Action detects a configuration file, validation will be performed unless this option is set to `false`.
356+
If there is no configuration file, validation is skipped.
357+
358+
The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using.
335359

336360
<details>
337361
<summary>Example</summary>
338362

339363
```yml
340364
uses: golangci/golangci-lint-action@v9
341365
with:
342-
github-token: xxx
366+
verify: false
343367
# ...
344368
```
345369

346370
</details>
347371

348-
### `verify`
372+
#### `github-token`
349373

350374
(optional)
351375

352-
This option is `true` by default.
353-
354-
If the GitHub Action detects a configuration file, validation will be performed unless this option is set to `false`.
355-
If there is no configuration file, validation is skipped.
376+
When using the `only-new-issues` option, the GitHub API is used, so a token is required.
356377

357-
The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using.
378+
By default, it uses the `github.token` from the action.
358379

359380
<details>
360381
<summary>Example</summary>
361382

362383
```yml
363384
uses: golangci/golangci-lint-action@v9
364385
with:
365-
verify: false
386+
github-token: xxx
366387
# ...
367388
```
368389

369390
</details>
370391

371-
### `only-new-issues`
392+
#### `only-new-issues`
372393

373394
(optional)
374395

@@ -393,7 +414,7 @@ with:
393414

394415
</details>
395416

396-
### `working-directory`
417+
#### `working-directory`
397418

398419
(optional)
399420

@@ -411,7 +432,7 @@ with:
411432

412433
</details>
413434

414-
### `args`
435+
#### `args`
415436

416437
(optional)
417438

@@ -438,17 +459,14 @@ with:
438459

439460
</details>
440461

441-
### `problem-matchers`
442-
443-
(optional)
444-
445-
Forces the usage of the embedded problem matchers.
462+
### Cache
446463

447-
By default, the [problem matcher of Go (`actions/setup-go`)](https://github.com/actions/setup-go/blob/main/matchers.json) already handles the default golangci-lint output (`text`).
464+
#### `skip-cache`
448465

449-
Works only with the `text` format (the golangci-lint default).
466+
(optional)
450467

451-
https://golangci-lint.run/usage/configuration/#output-configuration
468+
If set to `true`, all caching functionality will be completely disabled.
469+
This takes precedence over all other caching options.
452470

453471
The default value is `false`.
454472

@@ -458,18 +476,17 @@ The default value is `false`.
458476
```yml
459477
uses: golangci/golangci-lint-action@v9
460478
with:
461-
problem-matchers: true
479+
skip-cache: true
462480
# ...
463481
```
464482

465483
</details>
466484

467-
### `skip-cache`
485+
#### `skip-save-cache`
468486

469487
(optional)
470488

471-
If set to `true`, all caching functionality will be completely disabled.
472-
This takes precedence over all other caching options.
489+
If set to `true`, caches will not be saved, but they may still be restored, requiring `skip-cache: false`.
473490

474491
The default value is `false`.
475492

@@ -479,49 +496,57 @@ The default value is `false`.
479496
```yml
480497
uses: golangci/golangci-lint-action@v9
481498
with:
482-
skip-cache: true
499+
skip-save-cache: true
483500
# ...
484501
```
485502

486503
</details>
487504

488-
### `skip-save-cache`
505+
#### `cache-invalidation-interval`
489506

490507
(optional)
491508

492-
If set to `true`, caches will not be saved, but they may still be restored, requiring `skip-cache: false`.
509+
Periodically invalidate a cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded.
493510

494-
The default value is `false`.
511+
The default value is `7`.
512+
513+
If the number is `<= 0`, the cache will always be invalidated (not recommended).
495514

496515
<details>
497516
<summary>Example</summary>
498517

499518
```yml
500519
uses: golangci/golangci-lint-action@v9
501520
with:
502-
skip-save-cache: true
521+
cache-invalidation-interval: 15
503522
# ...
504523
```
505524

506525
</details>
507526

508-
### `cache-invalidation-interval`
527+
### Extra
528+
529+
#### `problem-matchers`
509530

510531
(optional)
511532

512-
Periodically invalidate a cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded.
533+
Forces the usage of the embedded problem matchers.
513534

514-
The default value is `7`.
535+
By default, the [problem matcher of Go (`actions/setup-go`)](https://github.com/actions/setup-go/blob/main/matchers.json) already handles the default golangci-lint output (`text`).
515536

516-
If the number is `<= 0`, the cache will always be invalidated (not recommended).
537+
Works only with the `text` format (the golangci-lint default).
538+
539+
https://golangci-lint.run/usage/configuration/#output-configuration
540+
541+
The default value is `false`.
517542

518543
<details>
519544
<summary>Example</summary>
520545

521546
```yml
522547
uses: golangci/golangci-lint-action@v9
523548
with:
524-
cache-invalidation-interval: 15
549+
problem-matchers: true
525550
# ...
526551
```
527552

action.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ inputs:
3434
description: "If set to true and the action runs on a pull request, the action outputs only newly found issues."
3535
default: 'false'
3636
required: false
37+
args:
38+
description: "golangci-lint command line arguments."
39+
default: ""
40+
required: false
3741
skip-cache:
3842
description: |
3943
If set to true, all caching functionality will be completely disabled.
@@ -42,22 +46,25 @@ inputs:
4246
required: false
4347
skip-save-cache:
4448
description: |
45-
If set to true, the action will not save any caches, but it may still
46-
restore existing caches, subject to other options.
49+
If set to true, the action will not save any caches,
50+
but it may still restore existing caches, subject to other options.
4751
default: 'false'
4852
required: false
53+
cache-invalidation-interval:
54+
description: "Periodically invalidate a cache when new code is added (number of days)."
55+
default: '7'
56+
required: false
4957
problem-matchers:
5058
description: "Force the usage of the embedded problem matchers."
5159
default: 'false'
5260
required: false
53-
args:
54-
description: "golangci-lint command line arguments."
61+
debug:
62+
description: |
63+
Debug options for the action.
64+
List of comma separated options, the values are `cache`, `clean`.
65+
example: "cache,clean"
5566
default: ""
5667
required: false
57-
cache-invalidation-interval:
58-
description: "Periodically invalidate a cache when new code is added (number of days)."
59-
default: '7'
60-
required: false
6168
runs:
6269
using: "node24"
6370
main: "dist/run/index.js"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/golangci/golangci-lint-action
22

3-
go 1.23
3+
go 1.24.0

0 commit comments

Comments
 (0)