Remove a call to getActionsApiClient
This commit is contained in:
parent
8a821a9c35
commit
09fb3ec514
3 changed files with 12 additions and 7 deletions
6
lib/codeql.js
generated
6
lib/codeql.js
generated
|
|
@ -48,7 +48,7 @@ function getCodeQLActionRepository(mode) {
|
||||||
const relativeScriptPathParts = relativeScriptPath.split(path.sep);
|
const relativeScriptPathParts = relativeScriptPath.split(path.sep);
|
||||||
return relativeScriptPathParts[0] + "/" + relativeScriptPathParts[1];
|
return relativeScriptPathParts[0] + "/" + relativeScriptPathParts[1];
|
||||||
}
|
}
|
||||||
async function getCodeQLBundleDownloadURL(githubUrl, mode, logger) {
|
async function getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger) {
|
||||||
const codeQLActionRepository = getCodeQLActionRepository(mode);
|
const codeQLActionRepository = getCodeQLActionRepository(mode);
|
||||||
const potentialDownloadSources = [
|
const potentialDownloadSources = [
|
||||||
// This GitHub instance, and this Action.
|
// This GitHub instance, and this Action.
|
||||||
|
|
@ -69,7 +69,7 @@ async function getCodeQLBundleDownloadURL(githubUrl, mode, logger) {
|
||||||
}
|
}
|
||||||
let [repositoryOwner, repositoryName] = repository.split("/");
|
let [repositoryOwner, repositoryName] = repository.split("/");
|
||||||
try {
|
try {
|
||||||
const release = await api.getActionsApiClient().repos.getReleaseByTag({
|
const release = await api.getApiClient(githubAuth, githubUrl).repos.getReleaseByTag({
|
||||||
owner: repositoryOwner,
|
owner: repositoryOwner,
|
||||||
repo: repositoryName,
|
repo: repositoryName,
|
||||||
tag: CODEQL_BUNDLE_VERSION
|
tag: CODEQL_BUNDLE_VERSION
|
||||||
|
|
@ -116,7 +116,7 @@ async function setupCodeQL(codeqlURL, githubAuth, githubUrl, tempDir, toolsDir,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!codeqlURL) {
|
if (!codeqlURL) {
|
||||||
codeqlURL = await getCodeQLBundleDownloadURL(githubUrl, mode, logger);
|
codeqlURL = await getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger);
|
||||||
}
|
}
|
||||||
const headers = { accept: 'application/octet-stream' };
|
const headers = { accept: 'application/octet-stream' };
|
||||||
// We only want to provide an authorization header if we are downloading
|
// We only want to provide an authorization header if we are downloading
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -121,7 +121,12 @@ function getCodeQLActionRepository(mode: util.Mode): string {
|
||||||
return relativeScriptPathParts[0] + "/" + relativeScriptPathParts[1];
|
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 codeQLActionRepository = getCodeQLActionRepository(mode);
|
||||||
const potentialDownloadSources = [
|
const potentialDownloadSources = [
|
||||||
// This GitHub instance, and this Action.
|
// This GitHub instance, and this Action.
|
||||||
|
|
@ -142,7 +147,7 @@ async function getCodeQLBundleDownloadURL(githubUrl: string, mode: util.Mode, lo
|
||||||
}
|
}
|
||||||
let [repositoryOwner, repositoryName] = repository.split("/");
|
let [repositoryOwner, repositoryName] = repository.split("/");
|
||||||
try {
|
try {
|
||||||
const release = await api.getActionsApiClient().repos.getReleaseByTag({
|
const release = await api.getApiClient(githubAuth, githubUrl).repos.getReleaseByTag({
|
||||||
owner: repositoryOwner,
|
owner: repositoryOwner,
|
||||||
repo: repositoryName,
|
repo: repositoryName,
|
||||||
tag: CODEQL_BUNDLE_VERSION
|
tag: CODEQL_BUNDLE_VERSION
|
||||||
|
|
@ -204,7 +209,7 @@ export async function setupCodeQL(
|
||||||
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||||
} else {
|
} else {
|
||||||
if (!codeqlURL) {
|
if (!codeqlURL) {
|
||||||
codeqlURL = await getCodeQLBundleDownloadURL(githubUrl, mode, logger);
|
codeqlURL = await getCodeQLBundleDownloadURL(githubAuth, githubUrl, mode, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers: IHeaders = {accept: 'application/octet-stream'};
|
const headers: IHeaders = {accept: 'application/octet-stream'};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue