github: use github token to download releases with actions/tool-cache 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 8e64b4303b
commit 503a033f4a
5 changed files with 35 additions and 5 deletions

View File

@@ -32,13 +32,16 @@ import {GitHubRelease} from '../types/github';
export interface InstallOpts {
standalone?: boolean;
githubToken?: string;
}
export class Install {
private readonly standalone: boolean | undefined;
private readonly githubToken: string | undefined;
constructor(opts?: InstallOpts) {
this.standalone = opts?.standalone;
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
}
/*
@@ -79,7 +82,7 @@ export class Install {
const downloadURL = util.format(version.downloadURL, vspec, this.filename());
core.info(`Downloading ${downloadURL}`);
const htcDownloadPath = await tc.downloadTool(downloadURL);
const htcDownloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
const cacheSavePath = await installCache.save(htcDownloadPath);