Remove a call to getActionsApiClient

This commit is contained in:
Robert Brignull 2020-09-01 14:01:21 +01:00
parent 8a821a9c35
commit 09fb3ec514
3 changed files with 12 additions and 7 deletions

6
lib/codeql.js generated
View file

@ -48,7 +48,7 @@ function getCodeQLActionRepository(mode) {
const relativeScriptPathParts = relativeScriptPath.split(path.sep);
return relativeScriptPathParts[0] + "/" + relativeScriptPathParts[1];
}
async function getCodeQLBundleDownloadURL(githubUrl, mode, logger) {
async function getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger) {
const codeQLActionRepository = getCodeQLActionRepository(mode);
const potentialDownloadSources = [
// This GitHub instance, and this Action.
@ -69,7 +69,7 @@ async function getCodeQLBundleDownloadURL(githubUrl, mode, logger) {
}
let [repositoryOwner, repositoryName] = repository.split("/");
try {
const release = await api.getActionsApiClient().repos.getReleaseByTag({
const release = await api.getApiClient(githubAuth, githubUrl).repos.getReleaseByTag({
owner: repositoryOwner,
repo: repositoryName,
tag: CODEQL_BUNDLE_VERSION
@ -116,7 +116,7 @@ async function setupCodeQL(codeqlURL, githubAuth, githubUrl, tempDir, toolsDir,
}
else {
if (!codeqlURL) {
codeqlURL = await getCodeQLBundleDownloadURL(githubUrl, mode, logger);
codeqlURL = await getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger);
}
const headers = { accept: 'application/octet-stream' };
// We only want to provide an authorization header if we are downloading

File diff suppressed because one or more lines are too long

View file

@ -121,7 +121,12 @@ function getCodeQLActionRepository(mode: util.Mode): string {
return relativeScriptPathParts[0] + "/" + relativeScriptPathParts[1];
}
async function getCodeQLBundleDownloadURL(githubUrl: string, mode: util.Mode, logger: Logger): Promise<string> {
async function getCodeQLBundleDownloadURL(
githubAuth: string,
githubUrl: string,
mode: util.Mode,
logger: Logger): Promise<string> {
const codeQLActionRepository = getCodeQLActionRepository(mode);
const potentialDownloadSources = [
// This GitHub instance, and this Action.
@ -142,7 +147,7 @@ async function getCodeQLBundleDownloadURL(githubUrl: string, mode: util.Mode, lo
}
let [repositoryOwner, repositoryName] = repository.split("/");
try {
const release = await api.getActionsApiClient().repos.getReleaseByTag({
const release = await api.getApiClient(githubAuth, githubUrl).repos.getReleaseByTag({
owner: repositoryOwner,
repo: repositoryName,
tag: CODEQL_BUNDLE_VERSION
@ -204,7 +209,7 @@ export async function setupCodeQL(
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
} else {
if (!codeqlURL) {
codeqlURL = await getCodeQLBundleDownloadURL(githubUrl, mode, logger);
codeqlURL = await getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger);
}
const headers: IHeaders = {accept: 'application/octet-stream'};