diff --git a/README.md b/README.md index 7ec4129aa3..9551bf4998 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,26 @@ You will also likely need to add the following `.gitattributes` file to ensure t ## Options -### `version` +### Overview + +| Option | Description | +|---------------------------------------------------------------|----------------------------------------------------| +| [`version`](#version) | The version of golangci-lint to use. | +| [`install-mode`](#install-mode) | The mode to install golangci-lint. | +| [`install-only`](#install-only) | Only install golangci-lint. | +| [`verify`](#verify) | Validates golangci-lint configuration file. | +| [`github-token`](#github-token) | Used by the `only-new-issues` option. | +| [`only-new-issues`](#only-new-issues) | Show only new issues. | +| [`working-directory`](#working-directory) | The golangci-lint working directory. | +| [`args`](#args) | Golangci-lint command line arguments. | +| [`skip-cache`](#skip-cache) | Disable cache support. | +| [`skip-save-cache`](#skip-save-cache) | Don't save cache. | +| [`cache-invalidation-interval`](#cache-invalidation-interval) | Number of days before cache invalidation. | +| [`problem-matchers`](#problem-matchers) | Forces the usage of the embedded problem matchers. | + +### Installation + +#### `version` (optional) @@ -282,7 +301,7 @@ with: -### `install-mode` +#### `install-mode` (optional) @@ -304,7 +323,7 @@ with: -### `install-only` +#### `install-only` (optional) @@ -325,13 +344,18 @@ with: -### `github-token` +### Run + +#### `verify` (optional) -When using the `only-new-issues` option, the GitHub API is used, so a token is required. +This option is `true` by default. -By default, it uses the `github.token` from the action. +If the GitHub Action detects a configuration file, validation will be performed unless this option is set to `false`. +If there is no configuration file, validation is skipped. + +The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using.
Example @@ -339,22 +363,19 @@ By default, it uses the `github.token` from the action. ```yml uses: golangci/golangci-lint-action@v9 with: - github-token: xxx + verify: false # ... ```
-### `verify` +#### `github-token` (optional) -This option is `true` by default. - -If the GitHub Action detects a configuration file, validation will be performed unless this option is set to `false`. -If there is no configuration file, validation is skipped. +When using the `only-new-issues` option, the GitHub API is used, so a token is required. -The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using. +By default, it uses the `github.token` from the action.
Example @@ -362,13 +383,13 @@ The JSON Schema used to validate the configuration depends on the version of gol ```yml uses: golangci/golangci-lint-action@v9 with: - verify: false + github-token: xxx # ... ```
-### `only-new-issues` +#### `only-new-issues` (optional) @@ -393,7 +414,7 @@ with: -### `working-directory` +#### `working-directory` (optional) @@ -411,7 +432,7 @@ with: -### `args` +#### `args` (optional) @@ -438,17 +459,14 @@ with: -### `problem-matchers` - -(optional) - -Forces the usage of the embedded problem matchers. +### Cache -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`). +#### `skip-cache` -Works only with the `text` format (the golangci-lint default). +(optional) -https://golangci-lint.run/usage/configuration/#output-configuration +If set to `true`, all caching functionality will be completely disabled. +This takes precedence over all other caching options. The default value is `false`. @@ -458,18 +476,17 @@ The default value is `false`. ```yml uses: golangci/golangci-lint-action@v9 with: - problem-matchers: true + skip-cache: true # ... ``` -### `skip-cache` +#### `skip-save-cache` (optional) -If set to `true`, all caching functionality will be completely disabled. -This takes precedence over all other caching options. +If set to `true`, caches will not be saved, but they may still be restored, requiring `skip-cache: false`. The default value is `false`. @@ -479,19 +496,21 @@ The default value is `false`. ```yml uses: golangci/golangci-lint-action@v9 with: - skip-cache: true + skip-save-cache: true # ... ``` -### `skip-save-cache` +#### `cache-invalidation-interval` (optional) -If set to `true`, caches will not be saved, but they may still be restored, requiring `skip-cache: false`. +Periodically invalidate a cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded. -The default value is `false`. +The default value is `7`. + +If the number is `<= 0`, the cache will always be invalidated (not recommended).
Example @@ -499,21 +518,27 @@ The default value is `false`. ```yml uses: golangci/golangci-lint-action@v9 with: - skip-save-cache: true + cache-invalidation-interval: 15 # ... ```
-### `cache-invalidation-interval` +### Extra + +#### `problem-matchers` (optional) -Periodically invalidate a cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded. +Forces the usage of the embedded problem matchers. -The default value is `7`. +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`). -If the number is `<= 0`, the cache will always be invalidated (not recommended). +Works only with the `text` format (the golangci-lint default). + +https://golangci-lint.run/usage/configuration/#output-configuration + +The default value is `false`.
Example @@ -521,7 +546,7 @@ If the number is `<= 0`, the cache will always be invalidated (not recommended). ```yml uses: golangci/golangci-lint-action@v9 with: - cache-invalidation-interval: 15 + problem-matchers: true # ... ``` diff --git a/action.yml b/action.yml index 059839294b..cb3120c094 100644 --- a/action.yml +++ b/action.yml @@ -34,6 +34,10 @@ inputs: description: "If set to true and the action runs on a pull request, the action outputs only newly found issues." default: 'false' required: false + args: + description: "golangci-lint command line arguments." + default: "" + required: false skip-cache: description: | If set to true, all caching functionality will be completely disabled. @@ -42,22 +46,25 @@ inputs: required: false skip-save-cache: description: | - If set to true, the action will not save any caches, but it may still - restore existing caches, subject to other options. + If set to true, the action will not save any caches, + but it may still restore existing caches, subject to other options. default: 'false' required: false + cache-invalidation-interval: + description: "Periodically invalidate a cache when new code is added (number of days)." + default: '7' + required: false problem-matchers: description: "Force the usage of the embedded problem matchers." default: 'false' required: false - args: - description: "golangci-lint command line arguments." + debug: + description: | + Debug options for the action. + List of comma separated options, the values are `cache`, `clean`. + example: "cache,clean" default: "" required: false - cache-invalidation-interval: - description: "Periodically invalidate a cache when new code is added (number of days)." - default: '7' - required: false runs: using: "node24" main: "dist/run/index.js" diff --git a/go.mod b/go.mod index 2ae3ad2f77..1dd27f9f33 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/golangci/golangci-lint-action -go 1.23 +go 1.24.0