diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index df320ce9b9..c86f06e2a1 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -2,10 +2,14 @@ name: "Code Scanning - Action" on: push: - branches: [ master ] + branches: + - master + - main pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: + - master + - main schedule: - cron: '0 17 * * 5' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8fa6e7af5f..2c17a13f28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,13 @@ name: "build-and-test" on: # rebuild any PRs and main branch changes pull_request: + branches: + - master + - main push: branches: - master + - main - "releases/*" jobs: @@ -53,8 +57,8 @@ jobs: version: - "" - "latest" - - "v1.60" - - "v1.60.1" + - "v1.60" # TODO(ldez): it should be updated for v2. + - "v1.60.1" # TODO(ldez): it should be updated for v2. runs-on: ${{ matrix.os }} permissions: contents: read @@ -82,8 +86,8 @@ jobs: version: - "" - "latest" - - "v1.60.1" - - "adbdfdb288e939a175182b7a12b7555215ce98b2" + - "v1.60.1" # TODO(ldez): it should be updated for v2. + - "adbdfdb288e939a175182b7a12b7555215ce98b2" # TODO(ldez): it should be updated for v2. runs-on: ${{ matrix.os }} permissions: contents: read diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 5873602831..811715bf90 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -93757,8 +93757,10 @@ async function goInstall(versionConfig) { core.info(`Installing golangci-lint ${versionConfig.TargetVersion}...`); const startedAt = Date.now(); const options = { env: { ...process.env, CGO_ENABLED: "1" } }; + // TODO(ldez): it should be updated for v2. const exres = await execShellCommand(`go install github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`, options); printOutput(exres); + // TODO(ldez): it should be updated for v2. const res = await execShellCommand(`go install -n github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`, options); printOutput(res); // The output of `go install -n` when the binary is already installed is `touch `. @@ -94329,6 +94331,7 @@ const versionRe = /^v(\d+)\.(\d+)(?:\.(\d+))?$/; const modVersionRe = /github.com\/golangci\/golangci-lint\s(v.+)/; const parseVersion = (s) => { if (s == "latest" || s == "") { + // TODO(ldez): it should be replaced with an explicit version (ex: v1.64.0) return null; } const match = s.match(versionRe); @@ -94348,6 +94351,7 @@ const stringifyVersion = (v) => { return `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}`; }; exports.stringifyVersion = stringifyVersion; +// TODO(ldez): it should be updated to v2.0.0. const minVersion = { major: 1, minor: 28, @@ -94397,7 +94401,8 @@ const getConfig = async () => { maxRetries: 5, }); try { - const url = `https://raw.githubusercontent.com/golangci/golangci-lint/master/assets/github-action-config.json`; + // TODO(ldez): HEAD should be replaced with an explicit version (ex: v1.64.0). + const url = `https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/assets/github-action-config-v1.json`; const response = await http.get(url); if (response.message.statusCode !== 200) { throw new Error(`failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); @@ -94413,6 +94418,8 @@ async function findLintVersion(mode) { core.info(`Finding needed golangci-lint version...`); if (mode == install_1.InstallMode.GoInstall) { const v = core.getInput(`version`); + // TODO(ldez): latest should be replaced with an explicit version (ex: v1.64.0). + // TODO(ldez): AssetURL should be updated for v2. return { TargetVersion: v ? v : "latest", AssetURL: "github.com/golangci/golangci-lint" }; } const reqLintVersion = getRequestedLintVersion(); diff --git a/dist/run/index.js b/dist/run/index.js index 109e89dc82..c0b48f8b9d 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -93757,8 +93757,10 @@ async function goInstall(versionConfig) { core.info(`Installing golangci-lint ${versionConfig.TargetVersion}...`); const startedAt = Date.now(); const options = { env: { ...process.env, CGO_ENABLED: "1" } }; + // TODO(ldez): it should be updated for v2. const exres = await execShellCommand(`go install github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`, options); printOutput(exres); + // TODO(ldez): it should be updated for v2. const res = await execShellCommand(`go install -n github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`, options); printOutput(res); // The output of `go install -n` when the binary is already installed is `touch `. @@ -94329,6 +94331,7 @@ const versionRe = /^v(\d+)\.(\d+)(?:\.(\d+))?$/; const modVersionRe = /github.com\/golangci\/golangci-lint\s(v.+)/; const parseVersion = (s) => { if (s == "latest" || s == "") { + // TODO(ldez): it should be replaced with an explicit version (ex: v1.64.0) return null; } const match = s.match(versionRe); @@ -94348,6 +94351,7 @@ const stringifyVersion = (v) => { return `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}`; }; exports.stringifyVersion = stringifyVersion; +// TODO(ldez): it should be updated to v2.0.0. const minVersion = { major: 1, minor: 28, @@ -94397,7 +94401,8 @@ const getConfig = async () => { maxRetries: 5, }); try { - const url = `https://raw.githubusercontent.com/golangci/golangci-lint/master/assets/github-action-config.json`; + // TODO(ldez): HEAD should be replaced with an explicit version (ex: v1.64.0). + const url = `https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/assets/github-action-config-v1.json`; const response = await http.get(url); if (response.message.statusCode !== 200) { throw new Error(`failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); @@ -94413,6 +94418,8 @@ async function findLintVersion(mode) { core.info(`Finding needed golangci-lint version...`); if (mode == install_1.InstallMode.GoInstall) { const v = core.getInput(`version`); + // TODO(ldez): latest should be replaced with an explicit version (ex: v1.64.0). + // TODO(ldez): AssetURL should be updated for v2. return { TargetVersion: v ? v : "latest", AssetURL: "github.com/golangci/golangci-lint" }; } const reqLintVersion = getRequestedLintVersion(); diff --git a/src/install.ts b/src/install.ts index 28929c9888..22935082e5 100644 --- a/src/install.ts +++ b/src/install.ts @@ -91,12 +91,14 @@ export async function goInstall(versionConfig: VersionConfig): Promise { const options: ExecOptions = { env: { ...process.env, CGO_ENABLED: "1" } } + // TODO(ldez): it should be updated for v2. const exres = await execShellCommand( `go install github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`, options ) printOutput(exres) + // TODO(ldez): it should be updated for v2. const res = await execShellCommand( `go install -n github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`, options diff --git a/src/version.ts b/src/version.ts index d1421e5c26..03e1a6d8bf 100644 --- a/src/version.ts +++ b/src/version.ts @@ -18,6 +18,7 @@ const modVersionRe = /github.com\/golangci\/golangci-lint\s(v.+)/ const parseVersion = (s: string): Version => { if (s == "latest" || s == "") { + // TODO(ldez): it should be replaced with an explicit version (ex: v1.64.0) return null } @@ -40,6 +41,7 @@ export const stringifyVersion = (v: Version): string => { return `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}` } +// TODO(ldez): it should be updated to v2.0.0. const minVersion = { major: 1, minor: 28, @@ -114,7 +116,8 @@ const getConfig = async (): Promise => { maxRetries: 5, }) try { - const url = `https://raw.githubusercontent.com/golangci/golangci-lint/master/assets/github-action-config.json` + // TODO(ldez): HEAD should be replaced with an explicit version (ex: v1.64.0). + const url = `https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/assets/github-action-config-v1.json` const response: httpm.HttpClientResponse = await http.get(url) if (response.message.statusCode !== 200) { throw new Error(`failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`) @@ -132,6 +135,8 @@ export async function findLintVersion(mode: InstallMode): Promise if (mode == InstallMode.GoInstall) { const v: string = core.getInput(`version`) + // TODO(ldez): latest should be replaced with an explicit version (ex: v1.64.0). + // TODO(ldez): AssetURL should be updated for v2. return { TargetVersion: v ? v : "latest", AssetURL: "github.com/golangci/golangci-lint" } }