Skip to content

Commit

Permalink
chore: 🚧 Drop support for pipx install
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanderleek committed Jan 2, 2025
1 parent 92b1271 commit 158da01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
16 changes: 2 additions & 14 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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']);
Expand Down
16 changes: 7 additions & 9 deletions src/codelimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -34,8 +33,13 @@ async function getLatestBinaryUrl() {
return `${downloadUrl}/${getBinaryName()}`;
}

export async function downloadCodeLimitBinary(): Promise<string> {
const binaryUrl = await getLatestBinaryUrl();
export async function downloadCodeLimitBinary(version: string): Promise<string> {
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());
Expand All @@ -45,12 +49,6 @@ export async function downloadCodeLimitBinary(): Promise<string> {
return filename;
}

export async function installCodeLimit(): Promise<string> {
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');
}
Expand Down

0 comments on commit 158da01

Please sign in to comment.