golangci-lint-action/action.yml
Pedro Tanaka 17e961267d
feat: add support for reading golangci-lint version from go.mod
Implements automatic version detection from go.mod files to keep
golangci-lint versions synchronized between the module and CI.

- Add new `go-mod-path` input parameter to specify custom go.mod location
- Automatically detect and use version from go.mod when no explicit version provided
- Force `goinstall` mode when using go.mod versions for compatibility
- Support both default go.mod and custom paths (e.g., tools/go.mod)

This eliminates the need to manually update versions in multiple places
and ensures CI uses the same golangci-lint version as the project.

Fixes #1268

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2025-08-21 12:54:47 +02:00

70 lines
2.7 KiB
YAML

# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
name: "Golangci-lint"
description: "Official golangci-lint action with line-attached annotations for found issues, caching, and parallel execution."
author: "golangci"
inputs:
version:
description: |
The version of golangci-lint to use.
When `install-mode` is:
- `binary` (default): the value can be v2.3, v2.3.4, or `latest` to use the latest version.
- `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
- `none`: the value is ignored.
required: false
go-mod-path:
description: |
Path to a go.mod file to read the golangci-lint version from.
If specified and version is not set, the action will parse the go.mod file
to determine the golangci-lint version. Default is "go.mod" in the working directory.
Note: When a version is read from go.mod, it automatically uses `goinstall` install-mode.
required: false
install-mode:
description: "The mode to install golangci-lint. It can be 'binary', 'goinstall', or 'none'."
default: "binary"
required: false
working-directory:
description: "golangci-lint working directory. The default is the project root."
required: false
github-token:
description: "The token is used for fetching the patch of a pull request to show only new issues."
default: ${{ github.token }}
required: false
verify:
description: "If set to true, the action verifies the configuration file against the JSONSchema."
default: 'true'
required: false
only-new-issues:
description: "If set to true and the action runs on a pull request, the action outputs only newly found issues."
default: 'false'
required: false
skip-cache:
description: |
If set to true, all caching functionality will be completely disabled.
This takes precedence over all other caching options.
default: 'false'
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.
default: 'false'
required: false
problem-matchers:
description: "Force the usage of the embedded problem matchers."
default: 'false'
required: false
args:
description: "golangci-lint command line arguments."
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: "node20"
main: "dist/run/index.js"
post: "dist/post_run/index.js"
branding:
icon: "shield"
color: "white"