async function cacheBazelisk()

in src/installer.ts [49:75]


async function cacheBazelisk(
  info: IBazeliskVersion,
  osFileName: string,
  token: string
): Promise<string> {
  const downloadPrefix: string =
    'https://github.com/bazelbuild/bazelisk/releases/download';
  const downloadUrl: string = `${downloadPrefix}/${info.tag_name}/${osFileName}`;
  core.info(`Acquiring ${info.tag_name} from ${downloadUrl}`);
  const auth = `token ${token}`;
  const downloadPath: string = await tc.downloadTool(
    downloadUrl,
    undefined,
    auth
  );

  core.info('Adding to the cache ...');
  fs.chmodSync(downloadPath, '755');
  const cachePath: string = await tc.cacheFile(
    downloadPath,
    'bazel',
    'bazelisk',
    info.tag_name
  );
  core.info(`Successfully cached bazelisk to ${cachePath}`);
  return cachePath;
}