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
6 changed files with 38 additions and 9 deletions

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" }
}