From 054bb2f631bec36b2d49c6bbaacd1832bc8fb3f1 Mon Sep 17 00:00:00 2001 From: xHyroM Date: Tue, 12 Jul 2022 18:42:27 +0200 Subject: [PATCH] chore: build --- dist/utils/getGithubRelease.js | 9 ++++++--- src/utils/getGithubRelease.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/utils/getGithubRelease.js b/dist/utils/getGithubRelease.js index aaf99a5..8cb70c7 100644 --- a/dist/utils/getGithubRelease.js +++ b/dist/utils/getGithubRelease.js @@ -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', '') }; }; diff --git a/src/utils/getGithubRelease.ts b/src/utils/getGithubRelease.ts index 763d424..855c9a0 100644 --- a/src/utils/getGithubRelease.ts +++ b/src/utils/getGithubRelease.ts @@ -16,7 +16,7 @@ export interface Release { } export default async(version: string, token: string): Promise => { - 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`;