diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index aa8ab55..af8bb9a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -73,6 +73,7 @@ jobs:
version: ${{ matrix.version }}
args: --timeout=5m --issues-exit-code=0 ./sample/...
only-new-issues: true
+ verify: true
test-go-install: # make sure the action works on a clean machine without building (go-install mode)
needs: [ build ]
@@ -103,8 +104,9 @@ jobs:
args: --timeout=5m --issues-exit-code=0 ./sample/...
only-new-issues: true
install-mode: goinstall
+ verify: true
- test-go-mod-version:
+ test-go-mod:
needs: [ build ]
strategy:
matrix:
@@ -113,6 +115,9 @@ jobs:
- ubuntu-24.04-arm
- macos-latest
- windows-latest
+ wd:
+ - sample-go-mod
+ - sample-go-tool
runs-on: ${{ matrix.os }}
permissions:
contents: read
@@ -123,27 +128,6 @@ jobs:
go-version: oldstable
- uses: ./
with:
- working-directory: sample-go-mod
- args: --timeout=5m --issues-exit-code=0 ./...
-
- test-go-tool-version:
- needs: [ build ]
- strategy:
- matrix:
- os:
- - ubuntu-latest
- - ubuntu-24.04-arm
- - macos-latest
- - windows-latest
- runs-on: ${{ matrix.os }}
- permissions:
- contents: read
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-go@v5
- with:
- go-version: stable
- - uses: ./
- with:
- working-directory: sample-go-tool
+ working-directory: ${{ matrix.wd }}
args: --timeout=5m --issues-exit-code=0 ./...
+ verify: true
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 0000000..ad24fce
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,6 @@
+output:
+ show-stats: true
+ sort-results: true
+ sort-order:
+ - linter
+ - file
\ No newline at end of file
diff --git a/README.md b/README.md
index be93de9..282afa9 100644
--- a/README.md
+++ b/README.md
@@ -318,6 +318,24 @@ with:
+### `verify`
+
+(optional)
+
+If set to true and the action verify the configuration file against the JSONSchema.
+
+
+Example
+
+```yml
+uses: golangci/golangci-lint-action@v6
+with:
+ verify: true
+ # ...
+```
+
+
+
### `only-new-issues`
(optional)
diff --git a/action.yml b/action.yml
index f4bdaaa..5e8e8e3 100644
--- a/action.yml
+++ b/action.yml
@@ -22,6 +22,10 @@ inputs:
description: "the token is used for fetching patch of a pull request to show only new issues"
default: ${{ github.token }}
required: false
+ verify:
+ description: "if set to true and the action verify the configuration file against the JSONSchema"
+ default: 'false'
+ 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'
diff --git a/dist/post_run/index.js b/dist/post_run/index.js
index 8978b4d..8586a27 100644
--- a/dist/post_run/index.js
+++ b/dist/post_run/index.js
@@ -94123,6 +94123,12 @@ async function runLint(binPath, patchPath) {
}
cmdArgs.cwd = path.resolve(workingDirectory);
}
+ if (core.getBooleanInput(`verify`, { required: true })) {
+ const cmdVerify = `${binPath} config verify`;
+ core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`);
+ const res = await execShellCommand(cmdVerify, cmdArgs);
+ printOutput(res);
+ }
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd();
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`);
const startedAt = Date.now();
diff --git a/dist/run/index.js b/dist/run/index.js
index 1ab7483..b9e694e 100644
--- a/dist/run/index.js
+++ b/dist/run/index.js
@@ -94123,6 +94123,12 @@ async function runLint(binPath, patchPath) {
}
cmdArgs.cwd = path.resolve(workingDirectory);
}
+ if (core.getBooleanInput(`verify`, { required: true })) {
+ const cmdVerify = `${binPath} config verify`;
+ core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`);
+ const res = await execShellCommand(cmdVerify, cmdArgs);
+ printOutput(res);
+ }
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd();
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`);
const startedAt = Date.now();
diff --git a/sample-go-mod/.golangci.yml b/sample-go-mod/.golangci.yml
new file mode 100644
index 0000000..ad24fce
--- /dev/null
+++ b/sample-go-mod/.golangci.yml
@@ -0,0 +1,6 @@
+output:
+ show-stats: true
+ sort-results: true
+ sort-order:
+ - linter
+ - file
\ No newline at end of file
diff --git a/sample-go-tool/.golangci.yml b/sample-go-tool/.golangci.yml
new file mode 100644
index 0000000..ad24fce
--- /dev/null
+++ b/sample-go-tool/.golangci.yml
@@ -0,0 +1,6 @@
+output:
+ show-stats: true
+ sort-results: true
+ sort-order:
+ - linter
+ - file
\ No newline at end of file
diff --git a/src/run.ts b/src/run.ts
index 09b0e1d..3addc14 100644
--- a/src/run.ts
+++ b/src/run.ts
@@ -137,6 +137,15 @@ async function runLint(binPath: string, patchPath: string): Promise {
cmdArgs.cwd = path.resolve(workingDirectory)
}
+ if (core.getBooleanInput(`verify`, { required: true })) {
+ const cmdVerify = `${binPath} config verify`
+
+ core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`)
+
+ const res = await execShellCommand(cmdVerify, cmdArgs)
+ printOutput(res)
+ }
+
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd()
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`)