Add no-cache option (#58)

This commit is contained in:
Max Schwenk 2024-02-23 14:09:38 -05:00 committed by GitHub
parent 0f37bd8169
commit d3603274ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 41 additions and 24 deletions

View file

@ -23,6 +23,7 @@ export type Input = {
profile?: boolean;
scope?: string;
registryUrl?: string;
noCache?: boolean;
};
export type Output = {
@ -123,7 +124,10 @@ export default async (options: Input): Promise<Output> => {
};
function isCacheEnabled(options: Input): boolean {
const { customUrl, version } = options;
const { customUrl, version, noCache } = options;
if (noCache) {
return false;
}
if (customUrl) {
return false;
}

View file

@ -1,7 +1,13 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import { existsSync, readFileSync } from "node:fs";
import { getInput, setOutput, setFailed, warning } from "@actions/core";
import {
getInput,
setOutput,
setFailed,
warning,
getBooleanInput,
} from "@actions/core";
import runAction from "./action.js";
if (!process.env.RUNNER_TEMP) {
@ -35,6 +41,7 @@ runAction({
customUrl: getInput("bun-download-url") || undefined,
registryUrl: getInput("registry-url") || undefined,
scope: getInput("scope") || undefined,
noCache: getBooleanInput("no-cache") || false,
})
.then(({ version, revision, cacheHit }) => {
setOutput("bun-version", version);