feat: allow to skip golangci-lint installation (#1079)

This commit is contained in:
Ludovic Fernandez
2024-07-30 00:16:22 +02:00
committed by GitHub
parent 9ec89731c3
commit aaa42aa062
8 changed files with 753 additions and 19 deletions

View File

@ -6,6 +6,7 @@ import * as fs from "fs"
import * as path from "path"
import { dir } from "tmp"
import { promisify } from "util"
import which from "which"
import { restoreCache, saveCache } from "./cache"
import { installLint, InstallMode } from "./install"
@ -22,6 +23,15 @@ function isOnlyNewIssues(): boolean {
async function prepareLint(): Promise<string> {
const mode = core.getInput("install-mode").toLowerCase()
if (mode === InstallMode.None) {
const bin = await which("golangci-lint", { nothrow: true })
if (!bin) {
throw new Error("golangci-lint binary not found in the PATH")
}
return bin
}
const versionConfig = await findLintVersion(<InstallMode>mode)
return await installLint(versionConfig, <InstallMode>mode)