fix: add token to install

This commit is contained in:
xHyroM 2022-07-28 07:59:44 +02:00
parent 079e10bfd6
commit 89f6825456
5 changed files with 7 additions and 6 deletions

View file

@ -26,7 +26,7 @@ const main = async() => {
info(`Going to install release ${release.version}`);
await install(release);
await install(release, token);
setOutput('bun-version', release.tag_name);
} catch(e) {

View file

@ -37,6 +37,7 @@ export default async(version: string, token: string, fullRepository: string, cus
]
};
}
const release: any = await (await fetch(url, {
headers: {
'Content-Type': 'application/json',

View file

@ -6,7 +6,7 @@ import getAsset from './getAsset.js';
import { join } from 'path';
import { homedir } from 'os';
export default async(release: Release) => {
export default async(release: Release, token: string) => {
const asset = getAsset(release.assets);
const path = join(homedir(), '.bun', 'bin', asset.name);
const cache = find('bun', release.version) || await restoreCache([path], `bun-${process.platform}-${asset.name}-${release.version}`);
@ -18,7 +18,7 @@ export default async(release: Release) => {
info(`Downloading Bun from ${asset.asset.browser_download_url}.`);
const zipPath = await downloadTool(asset.asset.browser_download_url);
const zipPath = await downloadTool(asset.asset.browser_download_url, `token ${token}`);
const extracted = await extractZip(zipPath, join(homedir(), '.bun', 'bin'));
const newCache = await cacheDir(