Skip to content

chore: use new assets file #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion dist/post_run/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion dist/run/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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,
Expand Down Expand Up @@ -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})`)
Expand All @@ -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" }
}

Expand Down
Loading