mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-04-18 09:45:46 +00:00
feat: allow to skip golangci-lint installation (#1079)
This commit is contained in:
parent
9ec89731c3
commit
aaa42aa062
8 changed files with 753 additions and 19 deletions
|
|
@ -38,6 +38,7 @@ const getAssetURL = (versionConfig: VersionConfig): string => {
|
|||
export enum InstallMode {
|
||||
Binary = "binary",
|
||||
GoInstall = "goinstall",
|
||||
None = "none",
|
||||
}
|
||||
|
||||
type ExecRes = {
|
||||
|
|
|
|||
10
src/run.ts
10
src/run.ts
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue