Compare commits

...

32 Commits

Author SHA1 Message Date
dependabot[bot]
2518447e2a build(deps): bump the dependencies group across 1 directory with 8 updates
Bumps the dependencies group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache) | `5.0.3` | `6.0.0` |
| [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `2.0.2` | `3.0.0` |
| [@actions/exec](https://github.com/actions/toolkit/tree/HEAD/packages/exec) | `2.0.0` | `3.0.0` |
| [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) | `7.0.0` | `9.0.0` |
| [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) | `3.0.0` | `4.0.0` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `25.0.10` | `25.2.3` |
| [which](https://github.com/npm/node-which) | `6.0.0` | `6.0.1` |



Updates `@actions/cache` from 5.0.3 to 6.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/cache)

Updates `@actions/core` from 2.0.2 to 3.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `@actions/exec` from 2.0.0 to 3.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/exec/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/exec)

Updates `@actions/github` from 7.0.0 to 9.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

Updates `@actions/http-client` from 3.0.1 to 3.0.2
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/http-client/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/http-client)

Updates `@actions/tool-cache` from 3.0.0 to 4.0.0
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/cache@4.0.0/packages/tool-cache)

Updates `@types/node` from 25.0.10 to 25.2.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `which` from 6.0.0 to 6.0.1
- [Release notes](https://github.com/npm/node-which/releases)
- [Changelog](https://github.com/npm/node-which/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-which/compare/v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: "@actions/cache"
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@actions/core"
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@actions/exec"
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@actions/github"
  dependency-version: 9.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@actions/http-client"
  dependency-version: 3.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@actions/tool-cache"
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@types/node"
  dependency-version: 25.2.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: which
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 08:21:55 +00:00
dependabot[bot]
b207e52793 build(deps): bump fast-xml-parser from 5.3.6 to 5.4.1 (#1351)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-02-28 08:20:15 +00:00
dependabot[bot]
f6671aa25d build(deps): bump minimatch from 3.1.3 to 3.1.5 (#1350)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-02-28 09:08:03 +01:00
Fernandez Ludovic
6b23cb2cbc docs: update examples 2026-02-28 08:31:27 +01:00
dependabot[bot]
02d66c3f78 build(deps): bump minimatch (#1348)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-02-25 00:54:57 +00:00
dependabot[bot]
17a5bf4dbc build(deps): bump fast-xml-parser from 5.3.4 to 5.3.6 (#1346)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-02-18 09:29:28 +00:00
dependabot[bot]
fce8c98977 build(deps-dev): bump the dev-dependencies group across 1 directory with 3 updates (#1344)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-02-16 15:15:42 +01:00
dependabot[bot]
b62bd5d234 build(deps-dev): bump the dev-dependencies group with 2 updates (#1340) 2026-02-02 12:01:18 +01:00
dependabot[bot]
d6deb2e8bd build(deps): bump fast-xml-parser from 5.3.3 to 5.3.4 (#1339)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-01-31 02:24:27 +01:00
dependabot[bot]
2c963d3543 build(deps): bump @types/node from 25.0.9 to 25.0.10 in the dependencies group (#1338) 2026-01-26 13:54:47 +01:00
dependabot[bot]
66754993e2 build(deps-dev): bump the dev-dependencies group with 3 updates (#1337) 2026-01-26 13:54:21 +01:00
dependabot[bot]
a3a03ee425 build(deps): bump the dependencies group with 2 updates (#1336)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-01-19 10:58:50 +00:00
dependabot[bot]
fd271f07e7 build(deps-dev): bump the dev-dependencies group with 4 updates (#1335) 2026-01-19 11:48:00 +01:00
dependabot[bot]
de73c35617 build(deps): bump the dependencies group with 6 updates (#1334)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-01-12 14:07:29 +00:00
dependabot[bot]
f75f4b02ef build(deps-dev): bump the dev-dependencies group with 2 updates (#1333)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2026-01-12 13:48:04 +00:00
dependabot[bot]
f75c1c4ee8 build(deps-dev): bump the dev-dependencies group with 2 updates (#1332) 2026-01-05 12:24:50 +01:00
dependabot[bot]
e9dc9291fd build(deps-dev): bump the dev-dependencies group with 2 updates (#1330) 2025-12-29 14:34:53 +01:00
dependabot[bot]
2e568c9b8b build(deps): bump @types/node from 25.0.2 to 25.0.3 in the dependencies group (#1329) 2025-12-22 17:18:27 +01:00
dependabot[bot]
6ad01b21aa build(deps-dev): bump the dev-dependencies group with 2 updates (#1328) 2025-12-22 17:17:59 +01:00
dependabot[bot]
ef750330e2 build(deps): bump the dependencies group with 4 updates (#1327)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2025-12-15 10:24:02 +00:00
dependabot[bot]
3ab2377cc3 build(deps-dev): bump the dev-dependencies group with 2 updates (#1326) 2025-12-15 11:13:55 +01:00
dependabot[bot]
ca80beefdd build(deps-dev): bump the dev-dependencies group with 3 updates (#1325) 2025-12-08 13:32:43 +01:00
Fernandez Ludovic
87a373f691 chore: update workflow 2025-12-08 13:12:37 +01:00
Fernandez Ludovic
7fa6da85a5 chore: update workflow 2025-12-08 12:54:19 +01:00
dependabot[bot]
1e7e51e771 build(deps): bump yaml from 2.8.1 to 2.8.2 in the dependencies group (#1324)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2025-12-01 13:01:48 +01:00
dependabot[bot]
5256ff0c0a build(deps-dev): bump the dev-dependencies group with 3 updates (#1323) 2025-12-01 12:32:33 +01:00
Fernandez Ludovic
13fed6f911 chore: update workflows 2025-11-28 17:39:49 +01:00
Fernandez Ludovic
7afe8ff863 chore: update workflows 2025-11-28 17:28:27 +01:00
Ludovic Fernandez
5a9289952f chore: move samples into fixtures (#1321) 2025-11-28 17:21:09 +01:00
Ludovic Fernandez
aa6fad0ea0 feat: add version-file option (#1320) 2025-11-28 16:54:48 +01:00
dependabot[bot]
a6071aaacb build(deps): bump actions/checkout from 5 to 6 (#1318) 2025-11-24 12:36:51 +01:00
dependabot[bot]
6e36c8460f build(deps-dev): bump the dev-dependencies group with 2 updates (#1317) 2025-11-24 12:36:23 +01:00
34 changed files with 94726 additions and 104867 deletions

View File

@@ -6,7 +6,7 @@
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"ecmaVersion": 2020, "ecmaVersion": 2020,
"sourceType": "module" "sourceType": "commonjs"
}, },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",

View File

@@ -11,6 +11,11 @@ on:
schedule: schedule:
- cron: '0 17 * * 5' - cron: '0 17 * * 5'
permissions:
actions: read
contents: read
security-events: write
jobs: jobs:
codeQL: codeQL:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
@@ -18,7 +23,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v6
with: with:
# Must fetch at least the immediate parents so that if this is # Must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head of the pull request. # a pull request then we can checkout the head of the pull request.
@@ -36,7 +41,7 @@ jobs:
uses: github/codeql-action/init@v4 uses: github/codeql-action/init@v4
# Override language selection by uncommenting this and choosing your languages # Override language selection by uncommenting this and choosing your languages
with: with:
language: 'javascript' languages: 'javascript-typescript'
- run: | - run: |
npm install npm install

View File

@@ -1,5 +1,6 @@
name: "build-and-test" name: "build-and-test"
on: # rebuild any PRs and main branch changes
on:
pull_request: pull_request:
branches: branches:
- main - main
@@ -7,22 +8,27 @@ on: # rebuild any PRs and main branch changes
branches: branches:
- main - main
permissions:
contents: read
jobs: jobs:
build: # make sure build/ci work properly # make sure build/ci work properly
build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version: 24.x node-version: 24.x
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- run: | - run: |
npm install npm install
npm run all npm run all
# Fail the build if there is dirty change # Fail the build if there are changes.
- run: git diff --exit-code -- dist - run: git diff --exit-code -- dist
test: # make sure the action works on a clean machine without building # make sure the action works on a clean machine without building
test:
needs: [ build ] needs: [ build ]
strategy: strategy:
matrix: matrix:
@@ -34,14 +40,14 @@ jobs:
version: version:
- "" - ""
- "latest" - "latest"
- "v2.5" - "v2.10"
- "v2.5.0" - "v2.10.1"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions: permissions:
contents: read contents: read
pull-requests: read pull-requests: read
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version: 24.x node-version: 24.x
@@ -51,10 +57,11 @@ jobs:
- uses: ./ - uses: ./
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
args: --timeout=5m --issues-exit-code=0 ./sample/... args: --timeout=5m --issues-exit-code=0 ./fixtures/simple/...
only-new-issues: true only-new-issues: true
test-go-install: # make sure the action works on a clean machine without building (go-install mode) # make sure the action works on a clean machine without building (go-install mode)
test-go-install:
needs: [ build ] needs: [ build ]
strategy: strategy:
matrix: matrix:
@@ -66,14 +73,14 @@ jobs:
version: version:
- "" - ""
- "latest" - "latest"
- "v2.5.0" - "v2.10.1"
- "655e8ede5178280b2a640e185bc4a343aed0f54e" - "f8861ca84d805a673945d037bae1559c3567aadc"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions: permissions:
contents: read contents: read
pull-requests: read pull-requests: read
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version: 24.x node-version: 24.x
@@ -83,7 +90,7 @@ jobs:
- uses: ./ - uses: ./
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
args: --timeout=5m --issues-exit-code=0 ./sample/... args: --timeout=5m --issues-exit-code=0 ./fixtures/simple/...
only-new-issues: true only-new-issues: true
install-mode: goinstall install-mode: goinstall
@@ -97,13 +104,13 @@ jobs:
- macos-latest - macos-latest
- windows-latest - windows-latest
wd: wd:
- sample-go-mod - fixtures/go-mod
- sample-go-tool - fixtures/go-tool
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions: permissions:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version: 24.x node-version: 24.x
@@ -115,7 +122,8 @@ jobs:
working-directory: ${{ matrix.wd }} working-directory: ${{ matrix.wd }}
args: --timeout=5m --issues-exit-code=0 ./... args: --timeout=5m --issues-exit-code=0 ./...
test-plugins: # make sure the action works on a clean machine with plugins # make sure the action works on a clean machine with plugins
test-plugins:
needs: [ build ] needs: [ build ]
strategy: strategy:
matrix: matrix:
@@ -127,14 +135,14 @@ jobs:
version: version:
- "" - ""
- "latest" - "latest"
- "v2.5" - "v2.10"
- "v2.5.0" - "v2.10.1"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions: permissions:
contents: read contents: read
pull-requests: read pull-requests: read
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version: 24.x node-version: 24.x
@@ -144,7 +152,7 @@ jobs:
- uses: ./ - uses: ./
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
working-directory: sample-plugins working-directory: fixtures/plugins
args: --timeout=5m --issues-exit-code=0 ./... args: --timeout=5m --issues-exit-code=0 ./...
test-monorepo: test-monorepo:
@@ -161,7 +169,7 @@ jobs:
contents: read contents: read
pull-requests: read pull-requests: read
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version: 24.x node-version: 24.x
@@ -170,6 +178,6 @@ jobs:
go-version: oldstable go-version: oldstable
- uses: ./ - uses: ./
with: with:
working-directory: sample-monorepo working-directory: fixtures/monorepo
experimental: "automatic-module-directories" experimental: "automatic-module-directories"
args: --timeout=5m --issues-exit-code=0 ./... args: --timeout=5m --issues-exit-code=0 ./...

View File

@@ -56,7 +56,7 @@ jobs:
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v9 uses: golangci/golangci-lint-action@v9
with: with:
version: v2.6 version: v2.10
``` ```
</details> </details>
@@ -94,7 +94,7 @@ jobs:
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v9 uses: golangci/golangci-lint-action@v9
with: with:
version: v2.6 version: v2.10
``` ```
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted: You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
@@ -120,7 +120,7 @@ on:
env: env:
GO_VERSION: stable GO_VERSION: stable
GOLANGCI_LINT_VERSION: v2.6 GOLANGCI_LINT_VERSION: v2.10
jobs: jobs:
detect-modules: detect-modules:
@@ -179,7 +179,7 @@ jobs:
with: with:
os: ${{ matrix.os }} os: ${{ matrix.os }}
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
golangci-lint-version: v2.6 golangci-lint-version: v2.10
``` ```
```yaml ```yaml
@@ -201,7 +201,7 @@ on:
golangci-lint-version: golangci-lint-version:
description: 'Golangci-lint version' description: 'Golangci-lint version'
type: string type: string
default: 'v2.6' default: 'v2.10'
jobs: jobs:
detect-modules: detect-modules:
@@ -261,21 +261,22 @@ You will also likely need to add the following `.gitattributes` file to ensure t
### Overview ### Overview
| Option | Description | | Option | Description |
|---------------------------------------------------------------|----------------------------------------------------| |---------------------------------------------------------------|-------------------------------------------------------|
| [`version`](#version) | The version of golangci-lint to use. | | [`version`](#version) | The version of golangci-lint to use. |
| [`install-mode`](#install-mode) | The mode to install golangci-lint. | | [`version-file`](#version-file) | Gets the version of golangci-lint to use from a file. |
| [`install-only`](#install-only) | Only install golangci-lint. | | [`install-mode`](#install-mode) | The mode to install golangci-lint. |
| [`verify`](#verify) | Validates golangci-lint configuration file. | | [`install-only`](#install-only) | Only install golangci-lint. |
| [`github-token`](#github-token) | Used by the `only-new-issues` option. | | [`verify`](#verify) | Validates golangci-lint configuration file. |
| [`only-new-issues`](#only-new-issues) | Show only new issues. | | [`github-token`](#github-token) | Used by the `only-new-issues` option. |
| [`working-directory`](#working-directory) | The golangci-lint working directory. | | [`only-new-issues`](#only-new-issues) | Show only new issues. |
| [`args`](#args) | Golangci-lint command line arguments. | | [`working-directory`](#working-directory) | The golangci-lint working directory. |
| [`skip-cache`](#skip-cache) | Disable cache support. | | [`args`](#args) | Golangci-lint command line arguments. |
| [`skip-save-cache`](#skip-save-cache) | Don't save cache. | | [`skip-cache`](#skip-cache) | Disable cache support. |
| [`cache-invalidation-interval`](#cache-invalidation-interval) | Number of days before cache invalidation. | | [`skip-save-cache`](#skip-save-cache) | Don't save cache. |
| [`problem-matchers`](#problem-matchers) | Forces the usage of the embedded problem matchers. | | [`cache-invalidation-interval`](#cache-invalidation-interval) | Number of days before cache invalidation. |
| [Experimental](#experimental) | Experimental options | | [`problem-matchers`](#problem-matchers) | Forces the usage of the embedded problem matchers. |
| [Experimental](#experimental) | Experimental options |
### Installation ### Installation
@@ -296,7 +297,29 @@ When `install-mode` is:
```yml ```yml
uses: golangci/golangci-lint-action@v9 uses: golangci/golangci-lint-action@v9
with: with:
version: v2.6 version: v2.10
# ...
```
</details>
#### `version-file`
Gets the version of golangci-lint to use from a file.
The path must be relative to the root of the project, or the `working-directory` if defined.
This parameter supports `.golangci-lint-version`, and `.tool-versions` files.
Only works with `install-mode: binary` (the default).
<details>
<summary>Example</summary>
```yml
uses: golangci/golangci-lint-action@v9
with:
version-file: .tool-versions
# ... # ...
``` ```

View File

@@ -11,6 +11,13 @@ inputs:
- `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit. - `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
- `none`: the value is ignored. - `none`: the value is ignored.
required: false required: false
version-file:
description: |
Gets the version of golangci-lint to use from a file.
The path must be relative to the root of the project, or the `working-directory` if defined.
This parameter supports `.golangci-lint-version`, and `.tool-versions` files.
Only works with `install-mode: binary` (the default).
required: false
install-mode: install-mode:
description: "The mode to install golangci-lint. It can be 'binary', 'goinstall', or 'none'." description: "The mode to install golangci-lint. It can be 'binary', 'goinstall', or 'none'."
default: "binary" default: "binary"

98597
dist/post_run/index.js generated vendored

File diff suppressed because one or more lines are too long

98597
dist/run/index.js generated vendored

File diff suppressed because one or more lines are too long

55
eslint.config.mjs Normal file
View File

@@ -0,0 +1,55 @@
import { defineConfig } from "eslint/config";
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default defineConfig([{
extends: fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
)),
plugins: {
"@typescript-eslint": fixupPluginRules(typescriptEslint),
"simple-import-sort": simpleImportSort,
},
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
parser: tsParser,
ecmaVersion: 2020,
sourceType: "commonjs",
},
rules: {
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"sort-imports": "off",
},
}]);

View File

@@ -1,4 +1,4 @@
module sample module github.com/golangci/sample
go 1.24.0 go 1.24.0

View File

@@ -1,4 +1,4 @@
module sample module github.com/golangci/sample
go 1.24.0 go 1.24.0

View File

@@ -1,4 +1,4 @@
version: v2.6.1 version: v2.10.1
name: custom-golangci-lint name: custom-golangci-lint
#destination: ./zzz/path/ #destination: ./zzz/path/

2144
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,31 +27,35 @@
"node": ">=24.0.0" "node": ">=24.0.0"
}, },
"dependencies": { "dependencies": {
"@actions/cache": "^4.1.0", "@actions/cache": "^6.0.0",
"@actions/core": "^1.11.1", "@actions/core": "^3.0.0",
"@actions/exec": "^1.1.1", "@actions/exec": "^3.0.0",
"@actions/github": "^6.0.1", "@actions/github": "^9.0.0",
"@actions/http-client": "^3.0.0", "@actions/http-client": "^3.0.0",
"@actions/tool-cache": "^4.0.0",
"@octokit/plugin-retry": "^6.1.0", "@octokit/plugin-retry": "^6.1.0",
"@actions/tool-cache": "^2.0.2", "@types/node": "^25.3.2",
"@types/node": "^24.10.1",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/tmp": "^0.2.6", "@types/tmp": "^0.2.6",
"@types/which": "^3.0.4", "@types/which": "^3.0.4",
"tmp": "^0.2.5", "tmp": "^0.2.5",
"which": "^6.0.0", "which": "^6.0.1",
"yaml": "^2.8.1" "yaml": "^2.8.2"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.46.4", "@eslint/compat": "^2.0.2",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@typescript-eslint/eslint-plugin": "^8.55.0",
"@typescript-eslint/parser": "^8.32.1", "@typescript-eslint/parser": "^8.32.1",
"@vercel/ncc": "^0.38.4", "@vercel/ncc": "^0.38.4",
"eslint": "^8.57.1", "eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0", "eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.4", "eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.6.2", "globals": "^17.3.0",
"prettier": "^3.8.1",
"typescript": "^5.9.3" "typescript": "^5.9.3"
} }
} }

View File

@@ -67,6 +67,12 @@ const isLessVersion = (a: Version, b: Version): boolean => {
const getRequestedVersion = (): Version => { const getRequestedVersion = (): Version => {
let requestedVersion = core.getInput(`version`) let requestedVersion = core.getInput(`version`)
let versionFilePath = core.getInput(`version-file`)
if (requestedVersion && versionFilePath) {
core.warning(`Both version (${requestedVersion}) and version-file (${versionFilePath}) inputs are specified, only version will be used`)
}
const workingDirectory = core.getInput(`working-directory`) const workingDirectory = core.getInput(`working-directory`)
let goMod = "go.mod" let goMod = "go.mod"
@@ -83,6 +89,27 @@ const getRequestedVersion = (): Version => {
} }
} }
if (requestedVersion == "" && versionFilePath) {
if (workingDirectory) {
versionFilePath = path.join(workingDirectory, versionFilePath)
}
if (!fs.existsSync(versionFilePath)) {
throw new Error(`The specified golangci-lint version file at: ${versionFilePath} does not exist`)
}
const content = fs.readFileSync(versionFilePath, "utf-8")
if (path.basename(versionFilePath) === ".tool-versions") {
// asdf/mise file.
const match = content.match(/^golangci-lint\s+([^\n#]+)/m)
requestedVersion = match ? "v" + match[1].trim().replace(/^v/gi, "") : ""
} else {
// .golangci-lint-version file.
requestedVersion = "v" + content.trim().replace(/^v/gi, "")
}
}
const parsedRequestedVersion = parseVersion(requestedVersion) const parsedRequestedVersion = parseVersion(requestedVersion)
if (parsedRequestedVersion == null) { if (parsedRequestedVersion == null) {
return null return null