mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 04:28:28 +02:00
fix: warn if bad version
This commit is contained in:
parent
5a78c10e01
commit
4e76ddea17
5 changed files with 28 additions and 20 deletions
17
src/index.ts
17
src/index.ts
|
@ -1,21 +1,26 @@
|
|||
import { getInput, info, setFailed, setOutput } from '@actions/core';
|
||||
import { getInput, info, setFailed, setOutput, warning } from '@actions/core';
|
||||
import getGithubRelease from './utils/getGithubRelease.js';
|
||||
import install from './utils/install.js';
|
||||
|
||||
const exit = (error: string) => {
|
||||
setFailed(error);
|
||||
process.exit();
|
||||
const exit = (error: string, miscTestBuilds?: boolean) => {
|
||||
if (miscTestBuilds) {
|
||||
warning(error);
|
||||
} else {
|
||||
setFailed(error);
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
|
||||
const main = async() => {
|
||||
try {
|
||||
const version = getInput('bun-version');
|
||||
const token = getInput('github-token');
|
||||
const miscTestBuilds = (getInput('misc-test-builds') === 'true');
|
||||
|
||||
if (!version) return exit('Invalid bun version.');
|
||||
|
||||
const release = await getGithubRelease(version, token);
|
||||
if (release?.message === 'Not Found') return exit('Invalid bun version.');
|
||||
const release = await getGithubRelease(version, token, miscTestBuilds);
|
||||
if (release?.message === 'Not Found') return exit('Invalid bun version.', miscTestBuilds);
|
||||
|
||||
info(`Going to install release ${release.version}`);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue