chore: use new assets file (#1154)

This commit is contained in:
Ludovic Fernandez 2025-02-04 15:15:08 +01:00 committed by GitHub
parent 5421a116d2
commit 1dd93d052e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 38 additions and 9 deletions

View File

@ -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'

View File

@ -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

9
dist/post_run/index.js generated vendored
View File

@ -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 <path_to_the_binary>`.
@ -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();

9
dist/run/index.js generated vendored
View File

@ -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 <path_to_the_binary>`.
@ -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();

View File

@ -91,12 +91,14 @@ export async function goInstall(versionConfig: VersionConfig): Promise<string> {
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

View File

@ -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<Config> => {
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<VersionConfig>
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" }
}