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