github: use github token to fetch releases JSON from CDN if available

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-10-28 09:09:16 +01:00
parent 503a033f4a
commit d970614050
6 changed files with 23 additions and 18 deletions

View File

@@ -54,7 +54,7 @@ export class Install {
const version: DownloadVersion = await Install.getDownloadVersion(v);
core.debug(`Install.download version: ${version.version}`);
const release: GitHubRelease = await Install.getRelease(version);
const release: GitHubRelease = await Install.getRelease(version, this.githubToken);
core.debug(`Install.download release tag name: ${release.tag_name}`);
const vspec = await this.vspec(release.tag_name);
@@ -213,8 +213,8 @@ export class Install {
}
}
public static async getRelease(version: DownloadVersion): Promise<GitHubRelease> {
const github = new GitHub();
public static async getRelease(version: DownloadVersion, githubToken?: string): Promise<GitHubRelease> {
const github = new GitHub({token: githubToken});
const releases = await github.releases('Compose', version.contentOpts);
if (!releases[version.version]) {
throw new Error(`Cannot find Compose release ${version.version} in releases JSON`);