Skip to content

Commit

Permalink
doc: improve options description
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 3, 2024
1 parent 57c4c9d commit 7a6f311
Showing 1 changed file with 78 additions and 58 deletions.
136 changes: 78 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.58

# Optional: working directory, useful for monorepos
# working-directory: somedir

# 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=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0

# Optional: Show only new issues.
# If you are using `merge_group` event (merge queue) you should add the option `fetch-depth: 0` to `actions/checkout` step.
# The default value is `false`.
# only-new-issues: true

# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, caches will not be saved, but they may still be restored,
# subject to other options
# skip-save-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
version: latest
```
We recommend running this action in a job separate from other jobs (`go test`, etc.)
Expand Down Expand Up @@ -117,35 +89,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.58

# Optional: working directory, useful for monorepos
# working-directory: somedir

# 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=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0

# Optional: Show only new issues.
# If you are using `merge_group` event (merge queue) you should add the option `fetch-depth: 0` to `actions/checkout` step.
# The default value is `false`.
# only-new-issues: true

# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, caches will not be saved, but they may still be restored,
# subject to other options
# skip-save-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
version: latest
```
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
Expand All @@ -154,6 +98,82 @@ You will also likely need to add the following `.gitattributes` file to ensure t
*.go text eol=lf
```

## Options

`version`: (required) The version of golangci-lint to use.
* When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
* When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.

```yml
uses: golangci/golangci-lint-action@v5
with:
version: v1.58
# ...
```

`install-mode`: (optional) The mode to install golangci-lint.
It can be `binary` or `goinstall`.
The default value is `binary`.

```yml
uses: golangci/golangci-lint-action@v5
with:
install-mode: "goinstall"
# ...
```

`only-new-issues`: (optional) Show only new issues.
If you are using `merge_group` event (merge queue) you should add the option `fetch-depth: 0` to `actions/checkout` step.
The default value is `false`.

```yml
uses: golangci/golangci-lint-action@v5
with:
only-new-issues: true
# ...
```

`working-directory`: (optional) working directory, useful for monorepos.

```yml
uses: golangci/golangci-lint-action@v5
with:
working-directory: somedir
# ...
```

`skip-cache`: (optional) If set to `true`, then all caching functionality will be completely disabled,
takes precedence over all other caching options.
The default value is `false`.

```yml
uses: golangci/golangci-lint-action@v5
with:
skip-cache: true
# ...
```

`skip-save-cache`: (optional) If set to `true`, caches will not be saved, but they may still be restored, required `skip-cache: false`.
The default value is `false`.

```yml
uses: golangci/golangci-lint-action@v5
with:
skip-save-cache: true
# ...
```

`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=`

```yml
uses: golangci/golangci-lint-action@v5
with:
args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
# ...
```

## Annotations

Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
Expand Down

0 comments on commit 7a6f311

Please sign in to comment.