From 80284ede25727d22b2f0d91af5f6fab0edb570bd Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 14 Feb 2025 22:19:04 +0100 Subject: [PATCH 1/6] chore: use ubuntu-22.04-arm ubuntu-24.04-arm is too unstable --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af8bb9aeac..0ccede3a20 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,7 +51,7 @@ jobs: matrix: os: - ubuntu-latest - - ubuntu-24.04-arm + - ubuntu-22.04-arm - macos-latest - windows-latest version: @@ -81,7 +81,7 @@ jobs: matrix: os: - ubuntu-latest - - ubuntu-24.04-arm + - ubuntu-22.04-arm - macos-latest - windows-latest version: @@ -112,7 +112,7 @@ jobs: matrix: os: - ubuntu-latest - - ubuntu-24.04-arm + - ubuntu-22.04-arm - macos-latest - windows-latest wd: From 696fa5c0e74367806ce8ce43eb0f19a8a0d3e91a Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 15 Feb 2025 02:47:53 +0100 Subject: [PATCH 2/6] chore: clean workflows --- .github/workflows/codeql.yaml | 2 -- .github/workflows/test.yml | 3 --- 2 files changed, 5 deletions(-) diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index c86f06e2a1..ab6facd100 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -3,12 +3,10 @@ name: "Code Scanning - Action" on: push: branches: - - master - main pull_request: # The branches below must be a subset of the branches above branches: - - master - main schedule: - cron: '0 17 * * 5' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0ccede3a20..52407a5b9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,13 +2,10 @@ name: "build-and-test" on: # rebuild any PRs and main branch changes pull_request: branches: - - master - main push: branches: - - master - main - - "releases/*" jobs: build: # make sure build/ci work properly From 6a3fb764d508e4ba6bec7000b7c7a827384ec250 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2025 03:19:17 +0100 Subject: [PATCH 3/6] build(deps): bump @octokit/request-error from 5.1.0 to 5.1.1 (#1169) Co-authored-by: Fernandez Ludovic --- dist/post_run/index.js | 2 +- dist/run/index.js | 2 +- package-lock.json | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 367f3bf47e..2a1e64ae2f 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -45240,7 +45240,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(? Date: Sat, 15 Feb 2025 04:31:44 +0100 Subject: [PATCH 4/6] build(deps): bump @octokit/endpoint from 9.0.5 to 9.0.6 (#1170) Co-authored-by: Fernandez Ludovic --- dist/post_run/index.js | 8 ++++---- dist/run/index.js | 8 ++++---- package-lock.json | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 2a1e64ae2f..ab3abd3e72 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -42098,7 +42098,7 @@ module.exports = __toCommonJS(dist_src_exports); var import_universal_user_agent = __nccwpck_require__(3843); // pkg/dist-src/version.js -var VERSION = "9.0.5"; +var VERSION = "9.0.6"; // pkg/dist-src/defaults.js var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`; @@ -42203,9 +42203,9 @@ function addQueryParameters(url, parameters) { } // pkg/dist-src/util/extract-url-variable-names.js -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; diff --git a/dist/run/index.js b/dist/run/index.js index 4a98ca2f84..1cd6762df6 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -42098,7 +42098,7 @@ module.exports = __toCommonJS(dist_src_exports); var import_universal_user_agent = __nccwpck_require__(3843); // pkg/dist-src/version.js -var VERSION = "9.0.5"; +var VERSION = "9.0.6"; // pkg/dist-src/defaults.js var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`; @@ -42203,9 +42203,9 @@ function addQueryParameters(url, parameters) { } // pkg/dist-src/util/extract-url-variable-names.js -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; diff --git a/package-lock.json b/package-lock.json index 5cfbd471bb..19929a5224 100644 --- a/package-lock.json +++ b/package-lock.json @@ -485,9 +485,10 @@ } }, "node_modules/@octokit/endpoint": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", - "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "license": "MIT", "dependencies": { "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" From 8d744d5b7f56a6baec6cc8b5f32947e1f52d05fc Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Sat, 15 Feb 2025 15:02:58 +0100 Subject: [PATCH 5/6] feat: verify with the JSONSchema by default (#1171) --- .github/workflows/test.yml | 3 --- action.yml | 2 +- dist/post_run/index.js | 41 ++++++++++++++++++++++++------- dist/run/index.js | 41 ++++++++++++++++++++++++------- src/run.ts | 50 +++++++++++++++++++++++++++++--------- 5 files changed, 104 insertions(+), 33 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52407a5b9b..e3545a7755 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,7 +70,6 @@ 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 ] @@ -101,7 +100,6 @@ jobs: args: --timeout=5m --issues-exit-code=0 ./sample/... only-new-issues: true install-mode: goinstall - verify: true test-go-mod: needs: [ build ] @@ -127,4 +125,3 @@ jobs: with: working-directory: ${{ matrix.wd }} args: --timeout=5m --issues-exit-code=0 ./... - verify: true diff --git a/action.yml b/action.yml index 5e8e8e3be1..1db3570795 100644 --- a/action.yml +++ b/action.yml @@ -24,7 +24,7 @@ inputs: required: false verify: description: "if set to true and the action verify the configuration file against the JSONSchema" - default: 'false' + 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" diff --git a/dist/post_run/index.js b/dist/post_run/index.js index ab3abd3e72..ae8fda3b17 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -94123,15 +94123,7 @@ async function runLint(binPath, patchPath) { } cmdArgs.cwd = path.resolve(workingDirectory); } - if (core.getBooleanInput(`verify`, { required: true })) { - let cmdVerify = `${binPath} config verify`; - if (userArgsMap.get("config")) { - cmdVerify += ` --config=${userArgsMap.get("config")}`; - } - core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`); - const res = await execShellCommand(cmdVerify, cmdArgs); - printOutput(res); - } + await runVerify(binPath, userArgsMap, cmdArgs); const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd(); core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`); const startedAt = Date.now(); @@ -94153,6 +94145,37 @@ async function runLint(binPath, patchPath) { } core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`); } +async function runVerify(binPath, userArgsMap, cmdArgs) { + const verify = core.getBooleanInput(`verify`, { required: true }); + if (!verify) { + return; + } + const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs); + if (!cfgPath) { + return; + } + let cmdVerify = `${binPath} config verify`; + if (userArgsMap.get("config")) { + cmdVerify += ` --config=${userArgsMap.get("config")}`; + } + core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`); + const res = await execShellCommand(cmdVerify, cmdArgs); + printOutput(res); +} +async function getConfigPath(binPath, userArgsMap, cmdArgs) { + let cmdConfigPath = `${binPath} config path`; + if (userArgsMap.get("config")) { + cmdConfigPath += ` --config=${userArgsMap.get("config")}`; + } + core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`); + try { + const resPath = await execShellCommand(cmdConfigPath, cmdArgs); + return resPath.stderr.trim(); + } + catch { + return ``; + } +} async function run() { try { const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv); diff --git a/dist/run/index.js b/dist/run/index.js index 1cd6762df6..49ceaa8fbc 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -94123,15 +94123,7 @@ async function runLint(binPath, patchPath) { } cmdArgs.cwd = path.resolve(workingDirectory); } - if (core.getBooleanInput(`verify`, { required: true })) { - let cmdVerify = `${binPath} config verify`; - if (userArgsMap.get("config")) { - cmdVerify += ` --config=${userArgsMap.get("config")}`; - } - core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`); - const res = await execShellCommand(cmdVerify, cmdArgs); - printOutput(res); - } + await runVerify(binPath, userArgsMap, cmdArgs); const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd(); core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`); const startedAt = Date.now(); @@ -94153,6 +94145,37 @@ async function runLint(binPath, patchPath) { } core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`); } +async function runVerify(binPath, userArgsMap, cmdArgs) { + const verify = core.getBooleanInput(`verify`, { required: true }); + if (!verify) { + return; + } + const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs); + if (!cfgPath) { + return; + } + let cmdVerify = `${binPath} config verify`; + if (userArgsMap.get("config")) { + cmdVerify += ` --config=${userArgsMap.get("config")}`; + } + core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`); + const res = await execShellCommand(cmdVerify, cmdArgs); + printOutput(res); +} +async function getConfigPath(binPath, userArgsMap, cmdArgs) { + let cmdConfigPath = `${binPath} config path`; + if (userArgsMap.get("config")) { + cmdConfigPath += ` --config=${userArgsMap.get("config")}`; + } + core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`); + try { + const resPath = await execShellCommand(cmdConfigPath, cmdArgs); + return resPath.stderr.trim(); + } + catch { + return ``; + } +} async function run() { try { const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv); diff --git a/src/run.ts b/src/run.ts index 19683f9a57..55864df795 100644 --- a/src/run.ts +++ b/src/run.ts @@ -137,17 +137,7 @@ async function runLint(binPath: string, patchPath: string): Promise { cmdArgs.cwd = path.resolve(workingDirectory) } - if (core.getBooleanInput(`verify`, { required: true })) { - let cmdVerify = `${binPath} config verify` - if (userArgsMap.get("config")) { - cmdVerify += ` --config=${userArgsMap.get("config")}` - } - - core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`) - - const res = await execShellCommand(cmdVerify, cmdArgs) - printOutput(res) - } + await runVerify(binPath, userArgsMap, cmdArgs) const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd() @@ -173,6 +163,44 @@ async function runLint(binPath: string, patchPath: string): Promise { core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`) } +async function runVerify(binPath: string, userArgsMap: Map, cmdArgs: ExecOptions): Promise { + const verify = core.getBooleanInput(`verify`, { required: true }) + if (!verify) { + return + } + + const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs) + if (!cfgPath) { + return + } + + let cmdVerify = `${binPath} config verify` + if (userArgsMap.get("config")) { + cmdVerify += ` --config=${userArgsMap.get("config")}` + } + + core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`) + + const res = await execShellCommand(cmdVerify, cmdArgs) + printOutput(res) +} + +async function getConfigPath(binPath: string, userArgsMap: Map, cmdArgs: ExecOptions): Promise { + let cmdConfigPath = `${binPath} config path` + if (userArgsMap.get("config")) { + cmdConfigPath += ` --config=${userArgsMap.get("config")}` + } + + core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`) + + try { + const resPath = await execShellCommand(cmdConfigPath, cmdArgs) + return resPath.stderr.trim() + } catch { + return `` + } +} + export async function run(): Promise { try { const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv) From 2226d7cb06a077cd73e56eedd38eecad18e5d837 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sat, 15 Feb 2025 15:16:43 +0100 Subject: [PATCH 6/6] 6.5.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19929a5224..328d45c0ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "golanci-lint-action", - "version": "6.4.1", + "version": "6.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "golanci-lint-action", - "version": "6.4.1", + "version": "6.5.0", "license": "MIT", "dependencies": { "@actions/cache": "^4.0.0", diff --git a/package.json b/package.json index f45a6fa282..170a98ef9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "golanci-lint-action", - "version": "6.4.1", + "version": "6.5.0", "private": true, "description": "golangci-lint github action", "main": "dist/main.js",