feat: added no-cache to action inputs

This commit is contained in:
Akalanka Perera 2024-02-22 20:04:15 +05:30
parent 0f37bd8169
commit 1c42f45010
6 changed files with 35 additions and 23 deletions

View file

@ -39,6 +39,7 @@ In most cases, you shouldn't need to use the [setup-node](https://github.com/act
| `bun-version` | The version of Bun to download and install. | `latest` | `canary`, `1.0.0`, `1.0.x` |
| `registry-url` | Registry URL where some private package is stored. | `undefined` | `"https://npm.pkg.github.com/"` |
| `scope` | Scope for private packages. | `undefined` | `"@foo"`, `"@orgname"` |
| `no-cache` | Disable caching of the downloaded executable. | `false` | `true`, `false` |
## Outputs

View file

@ -14,6 +14,9 @@ inputs:
scope:
required: false
description: "The scope for authenticating with the package registry."
no-cache:
required: false
description: "Disable caching of the downloaded executable."
outputs:
bun-version:
description: The version of Bun that was installed.

38
dist/setup/index.js generated vendored

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"private": true,
"name": "setup-bun",
"version": "1.1.1",
"version": "1.2.0",
"description": "Setup Bun on GitHub Actions.",
"keywords": [
"bun",

View file

@ -23,6 +23,7 @@ export type Input = {
profile?: boolean;
scope?: string;
registryUrl?: string;
noCache?: boolean;
};
export type Output = {
@ -123,8 +124,8 @@ export default async (options: Input): Promise<Output> => {
};
function isCacheEnabled(options: Input): boolean {
const { customUrl, version } = options;
if (customUrl) {
const { customUrl, noCache, version } = options;
if (customUrl || noCache) {
return false;
}
if (!version || /latest|canary|action/i.test(version)) {

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 {
getBooleanInput,
getInput,
setOutput,
setFailed,
warning,
} 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);