chore: base

This commit is contained in:
xHyroM 2022-07-11 09:45:23 +02:00
parent b04d87b14c
commit e187173d21
425 changed files with 1080881 additions and 5 deletions

View file

@ -0,0 +1,29 @@
import { fetch } from 'undici';
export interface Asset {
name: string;
browser_download_url: string;
}
export interface Release {
html_url: string;
tag_name: string;
message?: string;
assets: Asset[]
}
export default async(version: string, token: string): Promise<Release> => {
let url;
if (version === 'latest') url = 'https://api.github.com/repos/oven-sh/bun/releases/latest';
else url = `https://api.github.com/repos/oven-sh/bun/releases/tags/bun-v${version}`;
const release: any = await (await fetch(url, {
headers: {
'Content-Type': 'application/json',
'User-Agent': 'setup-bun-github-action',
'Authorization': token
}
})).json();
return release;
}