setup-uv/src/download/download-latest.ts
pollenjp c897c56b99 invert to a guard clause
Co-authored-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
2024-11-30 09:38:56 +09:00

16 lines
449 B
TypeScript

import { OWNER, REPO } from "../utils/constants";
import * as github from "@actions/github";
export async function getLatestVersion(githubToken: string) {
const octokit = github.getOctokit(githubToken);
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
owner: OWNER,
repo: REPO,
});
if (!latestRelease) {
throw new Error("Could not determine latest release.");
}
return latestRelease.tag_name;
}