mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-10-07 11:57:30 +00:00
Compare commits
No files matched your search
+1
-1
@@ -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",
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
- label: Yes, I've searched similar issues on GitHub and didn't find any.
|
- label: Yes, I've searched similar issues on GitHub and didn't find any.
|
||||||
required: true
|
required: true
|
||||||
- label: Yes, I've included all information below (version, config, etc).
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: problem
|
id: problem
|
||||||
@@ -25,6 +23,7 @@ body:
|
|||||||
id: golangci-lint-version
|
id: golangci-lint-version
|
||||||
attributes:
|
attributes:
|
||||||
label: Version of golangci-lint
|
label: Version of golangci-lint
|
||||||
|
placeholder: golangci-lint has version 2.x.x built with go1.x.x from xxxx on xxxx-xx-xx
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -32,6 +31,7 @@ body:
|
|||||||
id: github-action-version
|
id: github-action-version
|
||||||
attributes:
|
attributes:
|
||||||
label: Version of the GitHub Action
|
label: Version of the GitHub Action
|
||||||
|
placeholder: v9.2.0
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -69,6 +69,7 @@ body:
|
|||||||
id: go-env
|
id: go-env
|
||||||
attributes:
|
attributes:
|
||||||
label: Go version
|
label: Go version
|
||||||
|
placeholder: go1.25.8
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -86,3 +87,19 @@ body:
|
|||||||
</details>
|
</details>
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
id: validation
|
||||||
|
attributes:
|
||||||
|
label: Validation
|
||||||
|
options:
|
||||||
|
- label: Yes, I've included all the information above (example, version, config, etc.).
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
id: supporter
|
||||||
|
attributes:
|
||||||
|
label: Supporter
|
||||||
|
description: If you find golangci-lint valuable, consider [sponsoring the project](https://donate.golangci.org) to help sustain its development. 💛
|
||||||
|
options:
|
||||||
|
- label: I am a [sponsor/backer](https://donate.golangci.org) of this project.
|
||||||
@@ -42,3 +42,11 @@ body:
|
|||||||
placeholder: "Add any other context or screenshots about the feature request here."
|
placeholder: "Add any other context or screenshots about the feature request here."
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
id: supporter
|
||||||
|
attributes:
|
||||||
|
label: Supporter
|
||||||
|
description: If you find golangci-lint valuable, consider [sponsoring the project](https://donate.golangci.org) to help sustain its development. 💛
|
||||||
|
options:
|
||||||
|
- label: I am a [sponsor/backer](https://donate.golangci.org) of this project.
|
||||||
+10
-2
@@ -3,7 +3,13 @@ updates:
|
|||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: monthly
|
||||||
|
cooldown:
|
||||||
|
default-days: 7
|
||||||
|
groups:
|
||||||
|
github-actions:
|
||||||
|
patterns:
|
||||||
|
- "*" # Group all updates into a single larger pull request.
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
directory: "/"
|
directory: "/"
|
||||||
groups:
|
groups:
|
||||||
@@ -12,4 +18,6 @@ updates:
|
|||||||
dependencies:
|
dependencies:
|
||||||
dependency-type: production
|
dependency-type: production
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: monthly
|
||||||
|
cooldown:
|
||||||
|
default-days: 7
|
||||||
@@ -5,7 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
schedule:
|
schedule:
|
||||||
@@ -13,17 +12,20 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
codeQL:
|
codeQL:
|
||||||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
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.
|
||||||
# Only include this option if you are running this workflow on pull requests.
|
# Only include this option if you are running this workflow on pull requests.
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
# If this run was triggered by a pull request event then checkout
|
# If this run was triggered by a pull request event then checkout
|
||||||
# the head of the pull request instead of the merge commit.
|
# the head of the pull request instead of the merge commit.
|
||||||
@@ -33,14 +35,14 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4
|
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||||
# 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
|
||||||
npm run all
|
npm run all
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v4
|
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||||
+54
-49
@@ -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,28 @@ on: # rebuild any PRs and main branch changes
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 24.x
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- 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,27 +41,27 @@ jobs:
|
|||||||
version:
|
version:
|
||||||
- ""
|
- ""
|
||||||
- "latest"
|
- "latest"
|
||||||
- "v2.5"
|
- "v2.13"
|
||||||
- "v2.5.0"
|
- "v2.13.2"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- uses: actions/setup-node@v6
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 24.x
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
with:
|
with:
|
||||||
go-version: oldstable
|
go-version: oldstable
|
||||||
- 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,24 +73,23 @@ jobs:
|
|||||||
version:
|
version:
|
||||||
- ""
|
- ""
|
||||||
- "latest"
|
- "latest"
|
||||||
- "v2.5.0"
|
- "v2.13.2"
|
||||||
- "655e8ede5178280b2a640e185bc4a343aed0f54e"
|
- "dfd21f102e8031c6d4d1c8ec1d3e75c29197855c"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- uses: actions/setup-node@v6
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 24.x
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
with:
|
with:
|
||||||
go-version: oldstable
|
go-version: oldstable
|
||||||
- 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,17 +103,17 @@ 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:
|
|
||||||
contents: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- uses: actions/setup-node@v6
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 24.x
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
with:
|
with:
|
||||||
go-version: oldstable
|
go-version: oldstable
|
||||||
- uses: ./
|
- uses: ./
|
||||||
@@ -115,7 +121,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,24 +134,23 @@ jobs:
|
|||||||
version:
|
version:
|
||||||
- ""
|
- ""
|
||||||
- "latest"
|
- "latest"
|
||||||
- "v2.5"
|
- "v2.13"
|
||||||
- "v2.5.0"
|
- "v2.13.2"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- uses: actions/setup-node@v6
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 24.x
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
with:
|
with:
|
||||||
go-version: oldstable
|
go-version: oldstable
|
||||||
- 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:
|
||||||
@@ -157,19 +163,18 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- uses: actions/setup-node@v6
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 24.x
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
with:
|
with:
|
||||||
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 ./...
|
||||||
@@ -49,14 +49,14 @@ jobs:
|
|||||||
name: lint
|
name: lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: stable
|
go-version: stable
|
||||||
- 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.13
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@@ -87,14 +87,14 @@ jobs:
|
|||||||
name: lint
|
name: lint
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- 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.13
|
||||||
```
|
```
|
||||||
|
|
||||||
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.13
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect-modules:
|
detect-modules:
|
||||||
@@ -128,7 +128,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
modules: ${{ steps.set-modules.outputs.modules }}
|
modules: ${{ steps.set-modules.outputs.modules }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
@@ -142,7 +142,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
@@ -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.13
|
||||||
```
|
```
|
||||||
|
|
||||||
```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.13'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect-modules:
|
detect-modules:
|
||||||
@@ -209,7 +209,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
modules: ${{ steps.set-modules.outputs.modules }}
|
modules: ${{ steps.set-modules.outputs.modules }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{ inputs.go-version }}
|
go-version: ${{ inputs.go-version }}
|
||||||
@@ -224,7 +224,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{ inputs.go-version }}
|
go-version: ${{ inputs.go-version }}
|
||||||
@@ -247,7 +247,6 @@ You will also likely need to add the following `.gitattributes` file to ensure t
|
|||||||
|
|
||||||
* `v9.0.0` requires Nodejs runtime [`node24`](https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/)
|
* `v9.0.0` requires Nodejs runtime [`node24`](https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/)
|
||||||
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
||||||
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
|
||||||
* `v7.0.0` supports golangci-lint v2 only.
|
* `v7.0.0` supports golangci-lint v2 only.
|
||||||
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
|
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
|
||||||
* `v5.0.0+` removes `skip-pkg-cache` and `skip-build-cache` because the cache related to Go itself is already handled by `actions/setup-go`.
|
* `v5.0.0+` removes `skip-pkg-cache` and `skip-build-cache` because the cache related to Go itself is already handled by `actions/setup-go`.
|
||||||
@@ -262,8 +261,9 @@ 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. |
|
||||||
|
| [`version-file`](#version-file) | Gets the version of golangci-lint to use from a file. |
|
||||||
| [`install-mode`](#install-mode) | The mode to install golangci-lint. |
|
| [`install-mode`](#install-mode) | The mode to install golangci-lint. |
|
||||||
| [`install-only`](#install-only) | Only install golangci-lint. |
|
| [`install-only`](#install-only) | Only install golangci-lint. |
|
||||||
| [`verify`](#verify) | Validates golangci-lint configuration file. |
|
| [`verify`](#verify) | Validates golangci-lint configuration file. |
|
||||||
@@ -296,7 +296,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.13
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
|
</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
|
||||||
# ...
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -310,7 +332,7 @@ The mode to install golangci-lint: it can be `binary`, `goinstall`, or `none`.
|
|||||||
|
|
||||||
The default value is `binary`.
|
The default value is `binary`.
|
||||||
|
|
||||||
`goinstall` is not recommended, more explanations [here](https://golangci-lint.run/docs/welcome/install/#install-from-sources).
|
`goinstall` is not recommended, more explanations [here](https://golangci-lint.run/docs/welcome/install/local/#install-from-sources).
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Example</summary>
|
<summary>Example</summary>
|
||||||
@@ -594,6 +616,23 @@ with:
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
#### `no-run-logs-group`
|
||||||
|
|
||||||
|
(optional)
|
||||||
|
|
||||||
|
This option disables the grouping of logs from golangci-lint run.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Example</summary>
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: golangci/golangci-lint-action@v9
|
||||||
|
with:
|
||||||
|
experimental: "no-run-logs-group"
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Annotations
|
## Annotations
|
||||||
|
|
||||||
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
||||||
@@ -624,6 +663,22 @@ build and run the custom version of golangci-lint.
|
|||||||
|
|
||||||
For more information, see [module plugin system](https://golangci-lint.run/docs/plugins/module-plugins/).
|
For more information, see [module plugin system](https://golangci-lint.run/docs/plugins/module-plugins/).
|
||||||
|
|
||||||
|
## Tips
|
||||||
|
|
||||||
|
### Using Renovate to update the golangci-lint version
|
||||||
|
|
||||||
|
[Renovate](https://docs.renovatebot.com/) can update both the action and the
|
||||||
|
`golangci-lint` version it uses via its [github-actions manager](https://docs.renovatebot.com/modules/manager/github-actions/#commonly-used-community-actions)
|
||||||
|
which is included in presets like `config:recommended`.
|
||||||
|
|
||||||
|
It can also be enabled explicitly in `renovate.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"enabledManagers": ["github-actions"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Performance
|
## Performance
|
||||||
|
|
||||||
The action was implemented with performance in mind:
|
The action was implemented with performance in mind:
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -69,6 +76,7 @@ inputs:
|
|||||||
description: |
|
description: |
|
||||||
Experimental options for the action.
|
Experimental options for the action.
|
||||||
List of comma separated options.
|
List of comma separated options.
|
||||||
|
Available options: `automatic-module-directories`, `no-run-logs-group`
|
||||||
default: ""
|
default: ""
|
||||||
required: false
|
required: false
|
||||||
runs:
|
runs:
|
||||||
|
|||||||
+75301
-65750
File diff suppressed because it is too large.
Load diff
+75301
-65750
File diff suppressed because it is too large.
Load diff
@@ -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",
|
||||||
|
},
|
||||||
|
}]);
|
||||||
File renamed without changes.
@@ -1,4 +1,4 @@
|
|||||||
module sample
|
module github.com/golangci/sample
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
|
|||||||
module sample
|
module github.com/golangci/sample
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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/
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Generated
+1018
-1031
File diff suppressed because it is too large.
Load diff
+21
-14
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "golanci-lint-action",
|
"name": "golanci-lint-action",
|
||||||
"version": "8.0.0",
|
"version": "9.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "golangci-lint github action",
|
"description": "golangci-lint github action",
|
||||||
"main": "dist/main.js",
|
"main": "dist/main.js",
|
||||||
@@ -27,31 +27,38 @@
|
|||||||
"node": ">=24.0.0"
|
"node": ">=24.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^4.1.0",
|
"@actions/cache": "^5.0.3",
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^2.0.2",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^2.0.0",
|
||||||
"@actions/github": "^6.0.1",
|
"@actions/github": "^7.0.0",
|
||||||
"@actions/http-client": "^3.0.0",
|
"@actions/http-client": "^3.0.0",
|
||||||
|
"@actions/tool-cache": "^3.0.0",
|
||||||
"@octokit/plugin-retry": "^6.1.0",
|
"@octokit/plugin-retry": "^6.1.0",
|
||||||
"@actions/tool-cache": "^2.0.2",
|
"@types/node": "^25.0.10",
|
||||||
"@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.7",
|
||||||
"which": "^6.0.0",
|
"which": "^7.0.0",
|
||||||
"yaml": "^2.8.1"
|
"yaml": "^2.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
"@eslint/compat": "^2.0.5",
|
||||||
|
"@eslint/eslintrc": "^3.3.5",
|
||||||
|
"@eslint/js": "^9.39.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
||||||
"@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.5.0",
|
||||||
|
"prettier": "^3.8.2",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"undici": "^7.16.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -145,7 +145,7 @@ async function installBin(versionInfo: VersionInfo): Promise<string> {
|
|||||||
} else {
|
} else {
|
||||||
// We want to always overwrite files if the local cache already has them
|
// We want to always overwrite files if the local cache already has them
|
||||||
const args = ["xz"]
|
const args = ["xz"]
|
||||||
if (process.platform.toString() != "darwin") {
|
if (!["darwin", "freebsd"].includes(process.platform.toString())) {
|
||||||
args.push("--overwrite")
|
args.push("--overwrite")
|
||||||
}
|
}
|
||||||
extractedDir = await tc.extractTar(archivePath, process.env.HOME, args)
|
extractedDir = await tc.extractTar(archivePath, process.env.HOME, args)
|
||||||
|
|||||||
+14
-2
@@ -205,19 +205,31 @@ async function runLint(binPath: string): Promise<void> {
|
|||||||
|
|
||||||
const experimental = core.getInput(`experimental`).split(`,`)
|
const experimental = core.getInput(`experimental`).split(`,`)
|
||||||
|
|
||||||
|
const noGroup = experimental.includes(`no-run-logs-group`)
|
||||||
|
|
||||||
if (experimental.includes(`automatic-module-directories`)) {
|
if (experimental.includes(`automatic-module-directories`)) {
|
||||||
const wds = modulesAutoDetection(workingDirectory)
|
const wds = modulesAutoDetection(workingDirectory)
|
||||||
|
|
||||||
const cwd = process.cwd()
|
const cwd = process.cwd()
|
||||||
|
|
||||||
for (const wd of wds) {
|
for (const wd of wds) {
|
||||||
await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd))
|
await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd))
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory))
|
await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory))
|
||||||
|
}
|
||||||
|
|
||||||
|
async function optionalGroup<T>(noGroup: boolean, name: string, fn: () => Promise<T>): Promise<T> {
|
||||||
|
if (noGroup) {
|
||||||
|
core.info(name)
|
||||||
|
|
||||||
|
return fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
return core.group(name, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user