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:
@@ -36,13 +36,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -83,7 +86,7 @@ export class Install {
|
||||
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -63,6 +63,8 @@ export interface InstallOpts {
|
||||
|
||||
regctl?: Regctl;
|
||||
undock?: Undock;
|
||||
|
||||
githubToken?: string;
|
||||
}
|
||||
|
||||
interface LimaImage {
|
||||
@@ -80,6 +82,7 @@ export class Install {
|
||||
private readonly localTCPPort?: number;
|
||||
private readonly regctl: Regctl;
|
||||
private readonly undock: Undock;
|
||||
private readonly githubToken?: string;
|
||||
|
||||
private _version: string | undefined;
|
||||
private _toolDir: string | undefined;
|
||||
@@ -101,6 +104,7 @@ export class Install {
|
||||
this.localTCPPort = opts.localTCPPort;
|
||||
this.regctl = opts.regctl || new Regctl();
|
||||
this.undock = opts.undock || new Undock();
|
||||
this.githubToken = opts.githubToken || process.env.GITHUB_TOKEN;
|
||||
}
|
||||
|
||||
get toolDir(): string {
|
||||
@@ -211,7 +215,7 @@ export class Install {
|
||||
const downloadURL = this.downloadURL(component, this._version, src.channel);
|
||||
core.info(`Downloading ${downloadURL}`);
|
||||
|
||||
const downloadPath = await tc.downloadTool(downloadURL);
|
||||
const downloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
||||
core.debug(`docker.Install.downloadSourceArchive downloadPath: ${downloadPath}`);
|
||||
|
||||
let extractFolder;
|
||||
|
||||
@@ -29,7 +29,17 @@ import {GitHub} from '../github';
|
||||
import {GitHubRelease} from '../types/github';
|
||||
import {DownloadVersion} from '../types/regclient/regclient';
|
||||
|
||||
export interface InstallOpts {
|
||||
githubToken?: string;
|
||||
}
|
||||
|
||||
export class Install {
|
||||
private readonly githubToken: string | undefined;
|
||||
|
||||
constructor(opts?: InstallOpts) {
|
||||
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Download regclient binary from GitHub release
|
||||
* @param v: version semver version or latest
|
||||
@@ -68,7 +78,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);
|
||||
|
||||
@@ -29,7 +29,17 @@ import {GitHub} from '../github';
|
||||
import {GitHubRelease} from '../types/github';
|
||||
import {DownloadVersion} from '../types/undock/undock';
|
||||
|
||||
export interface InstallOpts {
|
||||
githubToken?: string;
|
||||
}
|
||||
|
||||
export class Install {
|
||||
private readonly githubToken: string | undefined;
|
||||
|
||||
constructor(opts?: InstallOpts) {
|
||||
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Download undock binary from GitHub release
|
||||
* @param v: version semver version or latest
|
||||
@@ -68,7 +78,7 @@ export class Install {
|
||||
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
||||
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}`);
|
||||
|
||||
let htcExtPath: string;
|
||||
|
||||
Reference in New Issue
Block a user