setup-uv/src/download/download-latest.ts

17 lines
455 B
TypeScript
Raw Normal View History

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