From 158da01d379d6aba95561c9e9224c93028b6e8a1 Mon Sep 17 00:00:00 2001 From: Rob van der Leek <5324924+robvanderleek@users.noreply.github.com> Date: Thu, 2 Jan 2025 21:56:17 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=9A=A7=20Drop=20support=20for=20?= =?UTF-8?q?pipx=20install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/action.ts | 16 ++-------------- src/codelimit.ts | 16 +++++++--------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/action.ts b/src/action.ts index 9e36e61..908a8ba 100644 --- a/src/action.ts +++ b/src/action.ts @@ -14,13 +14,7 @@ import { updateComment } from "./github"; import {exec, getExecOutput} from "@actions/exec"; -import { - downloadCodeLimitBinary, - getReportContent, - installCodeLimit, - makeNotFoundBadgeSvg, - makeStatusBadgeSvg -} from "./codelimit"; +import {downloadCodeLimitBinary, getReportContent, makeNotFoundBadgeSvg, makeStatusBadgeSvg} from "./codelimit"; import {getChangedFiles} from "./utils"; import {version} from "./version"; import signale, {error, info, success} from "signale"; @@ -129,13 +123,7 @@ async function updateRepository(octokit: Octokit, clBinary: string) { async function main() { info(`CodeLimit-action, version: ${version.revision}`); const codeLimitVersion = getInput('codelimit_version') || 'latest'; - info(`CodeLimit version requested: ${codeLimitVersion}`); - let clBinary; - if (codeLimitVersion === 'latest') { - clBinary = await downloadCodeLimitBinary(); - } else { - clBinary = await installCodeLimit(); - } + const clBinary = await downloadCodeLimitBinary(codeLimitVersion); info(`CodeLimit binary: ${clBinary}`); info('CodeLimit version:'); await exec(clBinary, ['--version']); diff --git a/src/codelimit.ts b/src/codelimit.ts index b8218a0..a3940e8 100644 --- a/src/codelimit.ts +++ b/src/codelimit.ts @@ -5,7 +5,6 @@ import {promisify} from "util"; import {makeBadge} from "badge-maker"; import {Codebase} from "./entities/Codebase"; import {info, success} from "signale"; -import {exec} from "@actions/exec"; const streamPipeline = promisify(require('stream').pipeline); @@ -34,8 +33,13 @@ async function getLatestBinaryUrl() { return `${downloadUrl}/${getBinaryName()}`; } -export async function downloadCodeLimitBinary(): Promise { - const binaryUrl = await getLatestBinaryUrl(); +export async function downloadCodeLimitBinary(version: string): Promise { + let binaryUrl; + if (version === 'latest') { + binaryUrl = await getLatestBinaryUrl(); + } else { + binaryUrl = `https://github.com/getcodelimit/codelimit/releases/download/${version}/${getBinaryName()}`; + } info(`Downloading CodeLimit binary from URL: ${binaryUrl}`); const response = await nodeFetch(binaryUrl); const filename = path.join(__dirname, getBinaryName()); @@ -45,12 +49,6 @@ export async function downloadCodeLimitBinary(): Promise { return filename; } -export async function installCodeLimit(): Promise { - await exec('pipx', ['install', 'git+https://github.com/getcodelimit/codelimit.git']); - await exec('pipx', ['list']); - return 'codelimit'; -} - export function getReportContent(): string | undefined { return fs.readFileSync('.codelimit_cache/codelimit.json', 'utf8'); }