feat: add an option to verify with the JSONSchema (#1167)
This commit is contained in:
committed by
GitHub
parent
32f961426b
commit
f7463c56f6
32
.github/workflows/test.yml
vendored
32
.github/workflows/test.yml
vendored
@ -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
|
||||
|
6
.golangci.yml
Normal file
6
.golangci.yml
Normal file
@ -0,0 +1,6 @@
|
||||
output:
|
||||
show-stats: true
|
||||
sort-results: true
|
||||
sort-order:
|
||||
- linter
|
||||
- file
|
18
README.md
18
README.md
@ -318,6 +318,24 @@ with:
|
||||
|
||||
</details>
|
||||
|
||||
### `verify`
|
||||
|
||||
(optional)
|
||||
|
||||
If set to true and the action verify the configuration file against the JSONSchema.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
verify: true
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `only-new-issues`
|
||||
|
||||
(optional)
|
||||
|
@ -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'
|
||||
|
6
dist/post_run/index.js
generated
vendored
6
dist/post_run/index.js
generated
vendored
@ -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();
|
||||
|
6
dist/run/index.js
generated
vendored
6
dist/run/index.js
generated
vendored
@ -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();
|
||||
|
6
sample-go-mod/.golangci.yml
Normal file
6
sample-go-mod/.golangci.yml
Normal file
@ -0,0 +1,6 @@
|
||||
output:
|
||||
show-stats: true
|
||||
sort-results: true
|
||||
sort-order:
|
||||
- linter
|
||||
- file
|
6
sample-go-tool/.golangci.yml
Normal file
6
sample-go-tool/.golangci.yml
Normal file
@ -0,0 +1,6 @@
|
||||
output:
|
||||
show-stats: true
|
||||
sort-results: true
|
||||
sort-order:
|
||||
- linter
|
||||
- file
|
@ -137,6 +137,15 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
||||
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()}] ...`)
|
||||
|
Reference in New Issue
Block a user