You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -264,7 +264,7 @@ You will also likely need to add the following `.gitattributes` file to ensure t
264
264
The version of golangci-lint to use.
265
265
266
266
When `install-mode` is:
267
-
* `binary` (default): the value can be v2.3 or v2.3.4 or `latest` to use the latest version.
267
+
* `binary` (default): the value can be v2.3, v2.3.4, or `latest` to use the latest version.
268
268
* `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
269
269
* `none`: the value is ignored.
270
270
@@ -304,7 +304,7 @@ with:
304
304
305
305
(optional)
306
306
307
-
When using `only-new-issues` option, the GitHub API is used, so a token is required.
307
+
When using the `only-new-issues` option, the GitHub API is used, so a token is required.
308
308
309
309
By default, it uses the `github.token` from the action.
310
310
@@ -326,8 +326,8 @@ with:
326
326
327
327
This option is `true` by default.
328
328
329
-
If the GitHub Action detects a configuration file, the validation will be performed unless this option is set to `false`.
330
-
If there is no configuration file, the validation is skipped.
329
+
If the GitHub Action detects a configuration file, validation will be performed unless this option is set to `false`.
330
+
If there is no configuration file, validation is skipped.
331
331
332
332
The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using.
333
333
@@ -352,9 +352,9 @@ Show only new issues.
352
352
The default value is `false`.
353
353
354
354
* `pull_request` and `pull_request_target`: the action gets the diff of the PR content from the [GitHub API](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request) and uses it with `--new-from-patch`.
355
-
* `push`: the action gets the diff of the push content (difference between commits before and after the push) from the [GitHub API](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits) and uses it with `--new-from-patch`.
356
-
* `merge_group`: the action gets the diff by using `--new-from-rev` option (relies on git).
357
-
You should add the option `fetch-depth: 0` to `actions/checkout` step.
355
+
* `push`: the action gets the diff of the push content (the difference between commits before and after the push) from the [GitHub API](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits) and uses it with `--new-from-patch`.
356
+
* `merge_group`: the action gets the diff by using the `--new-from-rev` option (relies on git).
357
+
You should add the option `fetch-depth: 0` to the `actions/checkout` step.
358
358
359
359
<details>
360
360
<summary>Example</summary>
@@ -372,7 +372,7 @@ with:
372
372
373
373
(optional)
374
374
375
-
Working directory, useful for monorepos.
375
+
The golangci-lint working directory, useful for monorepos. The default is the project root.
376
376
377
377
<details>
378
378
<summary>Example</summary>
@@ -406,7 +406,7 @@ golangci-lint command line arguments.
406
406
uses: golangci/golangci-lint-action@v8
407
407
with:
408
408
# In some rare cases,
409
-
# you could have to use `${{ github.workspace }}` as base directory to reference your configuration file.
409
+
# you may need to use `${{ github.workspace }}` as the base directory to reference your configuration file.
Forces the usage of the embedded problem matchers.
421
421
422
422
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`).
423
423
424
-
Works only with `text` format (the golangci-lint default).
424
+
Works only with the `text` format (the golangci-lint default).
If set to `true`, then all caching functionality will be completely disabled,
447
-
takes precedence over all other caching options.
446
+
If set to `true`, all caching functionality will be completely disabled.
447
+
This takes precedence over all other caching options.
448
448
449
449
The default value is `false`.
450
450
@@ -484,11 +484,11 @@ with:
484
484
485
485
(optional)
486
486
487
-
Periodically invalidate the cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded.
487
+
Periodically invalidate a cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded.
488
488
489
489
The default value is `7`.
490
490
491
-
If the number is `<= 0`, the cache will always be invalidated (Not recommended).
491
+
If the number is `<= 0`, the cache will always be invalidated (not recommended).
492
492
493
493
<details>
494
494
<summary>Example</summary>
@@ -506,11 +506,11 @@ with:
506
506
507
507
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
508
508
509
-
The restrictions of annotations are the following:
509
+
The restrictions of annotations are as follows:
510
510
511
-
1. Currently, they don't support Markdown formatting (see the [feature request](https://github.community/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704))
511
+
1. Currently, they don't support Markdown formatting (see the [feature request](https://github.community/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704)).
512
512
2. They aren't shown in the list of comments.
513
-
If you would like to have comments - please, up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
513
+
If you would like to have comments, please up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
514
514
3. The number of annotations is [limited](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md#limitations).
515
515
516
516
Permissions required:
@@ -519,7 +519,7 @@ Permissions required:
519
519
permissions:
520
520
# Required: allow read access to the content for analysis.
521
521
contents: read
522
-
# Optional: allow read access to pull request. Use with `only-new-issues` option.
522
+
# Optional: allow read access to pull requests. Use with `only-new-issues` option.
523
523
pull-requests: read
524
524
```
525
525
@@ -531,42 +531,42 @@ The action was implemented with performance in mind:
531
531
532
532
1. We cache data from golangci-lint analysis between builds by using [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache).
533
533
2. We don't use Docker because image pulling is slow.
534
-
3. We do as much as we can in parallel, e.g. we download cache, and golangci-lint binary in parallel.
534
+
3. We do as much as we can in parallel, e.g., we download the cache and the golangci-lint binary in parallel.
535
535
536
-
For example, in a repository of [golangci-lint](https://github.com/golangci/golangci-lint) running this action without the cache takes 50s, but with cache takes 14s:
536
+
For example, in the [golangci-lint](https://github.com/golangci/golangci-lint) repository, running this action without the cache takes 50s, but with the cache it takes 14s:
537
537
* in parallel:
538
538
* 4s to restore 50 MB of cache
539
539
* 1s to find and install `golangci-lint`
540
540
* 1s to run `golangci-lint` (it takes 35s without cache)
541
541
542
542
## Internals
543
543
544
-
We use JavaScript-based action.
545
-
We don't use Docker-based action because:
544
+
We use a JavaScript-based action.
545
+
We don't use a Docker-based action because:
546
546
547
-
1. Docker pulling is slow currently
548
-
2. it's easier to use caching from [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache)
547
+
1. Pulling Docker images is currently slow.
548
+
2. It is easier to use caching from [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache).
549
549
550
-
We support different platforms, such as `ubuntu`, `macos`, and `windows` with `x32` and `x64` archs.
550
+
We support different platforms, such as `ubuntu`, `macos`, and `windows` with `x32` and `x64` architectures.
551
551
552
-
Inside our action, we perform 3 steps:
552
+
Inside our action, we perform three steps:
553
553
554
-
1. Setup environment running in parallel:
555
-
* restore [cache](https://github.com/actions/cache) of previous analyses
556
-
* fetch [action config](https://github.com/golangci/golangci-lint/blob/HEAD/assets/github-action-config.json) and find the latest `golangci-lint` patch version for needed version
557
-
(users of this action can specify only minor version of `golangci-lint`).
558
-
After that install [golangci-lint](https://github.com/golangci/golangci-lint) using [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache)
559
-
2. Run `golangci-lint` with specified by user `args`
560
-
3. Save cache for later builds
554
+
1. Set up the environment in parallel:
555
+
* Restore the [cache](https://github.com/actions/cache) from previous analyses.
556
+
* Fetch the [action config](https://github.com/golangci/golangci-lint/blob/HEAD/assets/github-action-config.json) and find the latest `golangci-lint` patch version for the required version
557
+
(users of this action can specify only the minor version of `golangci-lint`).
558
+
After that, install [golangci-lint](https://github.com/golangci/golangci-lint) using [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache).
559
+
2. Run `golangci-lint` with the arguments `args` specified by the user.
560
+
3. Save the cache for later builds.
561
561
562
562
### Caching internals
563
563
564
564
1. We save and restore the following directory: `~/.cache/golangci-lint`.
565
565
2. The primary caching key looks like `golangci-lint.cache-{runner_os}-{working_directory}-{interval_number}-{go.mod_hash}`.
566
-
Interval number ensures that we periodically invalidate our cache (every 7 days).
567
-
`go.mod`hash ensures that we invalidate the cache early - as soon as dependencies have changed.
566
+
The interval number ensures that we periodically invalidate our cache (every 7 days).
567
+
The `go.mod` hash ensures that we invalidate the cache early — as soon as dependencies have changed.
568
568
3. We use [restore keys](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key):
0 commit comments