mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-04-04 10:40:40 +08:00
chore: build
This commit is contained in:
parent
9f7c2a5c23
commit
054bb2f631
9
dist/utils/getGithubRelease.js
vendored
9
dist/utils/getGithubRelease.js
vendored
@ -1,10 +1,13 @@
|
||||
import { getInput } from '@actions/core';
|
||||
import fetch from 'node-fetch';
|
||||
export default async (version, token) => {
|
||||
const miscTestBuilds = (getInput('misc-test-builds') === 'true');
|
||||
const repository = miscTestBuilds ? miscTestBuilds : 'oven-sh/bun';
|
||||
let url;
|
||||
if (version === 'latest')
|
||||
url = 'https://api.github.com/repos/oven-sh/bun/releases/latest';
|
||||
url = `https://api.github.com/repos/${repository}/releases/latest`;
|
||||
else
|
||||
url = `https://api.github.com/repos/oven-sh/bun/releases/tags/bun-v${version}`;
|
||||
url = `https://api.github.com/repos/${repository}/releases/tags/bun-v${version}`;
|
||||
const release = await (await fetch(url, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -14,6 +17,6 @@ export default async (version, token) => {
|
||||
})).json();
|
||||
return {
|
||||
...release,
|
||||
version: release.tag_name.replace('bun-v', '')
|
||||
version: miscTestBuilds ? new Date(release.name).getTime() : release.tag_name.replace('bun-v', '')
|
||||
};
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ export interface Release {
|
||||
}
|
||||
|
||||
export default async(version: string, token: string): Promise<Release> => {
|
||||
const miscTestBuilds = getInput('misc-test-builds');
|
||||
const miscTestBuilds = (getInput('misc-test-builds') === 'true');
|
||||
const repository = miscTestBuilds ? miscTestBuilds : 'oven-sh/bun'
|
||||
let url;
|
||||
if (version === 'latest') url = `https://api.github.com/repos/${repository}/releases/latest`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user