Merge branch 'main' into simon-engledew/lint-workspace

This commit is contained in:
Simon Engledew
2020-11-24 14:55:54 +00:00
36 changed files with 255 additions and 258 deletions

View File

@@ -64,6 +64,10 @@ async function run() {
"Config file could not be found at expected location. Has the 'init' action been called?"
);
}
const apiDetails = {
auth: actionsUtil.getRequiredInput("token"),
url: actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
};
stats = await runAnalyze(
parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")),
await actionsUtil.getCommitOid(),
@@ -73,8 +77,7 @@ async function run() {
actionsUtil.getWorkflowRunID(),
actionsUtil.getRequiredInput("checkout_path"),
actionsUtil.getRequiredInput("matrix"),
actionsUtil.getRequiredInput("token"),
actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
apiDetails,
actionsUtil.getRequiredInput("upload") === "true",
"actions",
actionsUtil.getRequiredInput("output"),

View File

@@ -4,6 +4,7 @@ import * as path from "path";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as analysisPaths from "./analysis-paths";
import { GitHubApiDetails } from "./api-client";
import { getCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import { isScannedLanguage, Language } from "./languages";
@@ -224,8 +225,7 @@ export async function runAnalyze(
workflowRunID: number | undefined,
checkoutPath: string,
environment: string | undefined,
githubAuth: string,
githubUrl: string,
apiDetails: GitHubApiDetails,
doUpload: boolean,
mode: util.Mode,
outputDir: string,
@@ -268,8 +268,7 @@ export async function runAnalyze(
workflowRunID,
checkoutPath,
environment,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);

View File

@@ -17,14 +17,18 @@ export enum DisallowedAPIVersionReason {
ACTION_TOO_NEW,
}
export interface GitHubApiDetails {
auth: string;
url: string;
}
const GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
const CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR =
"CODEQL_ACTION_WARNED_ABOUT_VERSION";
let hasBeenWarnedAboutVersion = false;
export const getApiClient = function (
githubAuth: string,
githubUrl: string,
apiDetails: GitHubApiDetails,
mode: Mode,
logger: Logger,
allowLocalRun = false,
@@ -78,8 +82,8 @@ export const getApiClient = function (
});
});
return new customOctokit(
githubUtils.getOctokitOptions(githubAuth, {
baseUrl: getApiUrl(githubUrl),
githubUtils.getOctokitOptions(apiDetails.auth, {
baseUrl: getApiUrl(apiDetails.url),
userAgent: "CodeQL Action",
log: consoleLogLevel({ level: "debug" }),
})
@@ -104,13 +108,12 @@ function getApiUrl(githubUrl: string): string {
// Once all code has been converted this function should be removed or made canonical
// and called only from the action entrypoints.
export function getActionsApiClient(allowLocalRun = false) {
return getApiClient(
getRequiredInput("token"),
getRequiredEnvParam("GITHUB_SERVER_URL"),
"actions",
getActionsLogger(),
allowLocalRun
);
const apiDetails = {
auth: getRequiredInput("token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
};
return getApiClient(apiDetails, "actions", getActionsLogger(), allowLocalRun);
}
export function apiVersionInRange(

View File

@@ -12,6 +12,11 @@ import * as util from "./util";
setupTests(test);
const sampleApiDetails = {
auth: "token",
url: "https://github.com",
};
test("download codeql bundle cache", async (t) => {
await util.withTmpDir(async (tmpDir) => {
const versions = ["20200601", "20200610"];
@@ -28,8 +33,7 @@ test("download codeql bundle cache", async (t) => {
await codeql.setupCodeQL(
`https://example.com/download/codeql-bundle-${version}/codeql-bundle.tar.gz`,
"token",
"https://github.example.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -56,8 +60,7 @@ test("download codeql bundle cache explicitly requested with pinned different ve
await codeql.setupCodeQL(
"https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz",
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -75,8 +78,7 @@ test("download codeql bundle cache explicitly requested with pinned different ve
await codeql.setupCodeQL(
"https://example.com/download/codeql-bundle-20200610/codeql-bundle.tar.gz",
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -98,8 +100,7 @@ test("don't download codeql bundle cache with pinned different version cached",
await codeql.setupCodeQL(
"https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz",
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -110,8 +111,7 @@ test("don't download codeql bundle cache with pinned different version cached",
await codeql.setupCodeQL(
undefined,
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -135,8 +135,7 @@ test("download codeql bundle cache with different version cached (not pinned)",
await codeql.setupCodeQL(
"https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz",
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -162,8 +161,7 @@ test("download codeql bundle cache with different version cached (not pinned)",
await codeql.setupCodeQL(
undefined,
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -187,8 +185,7 @@ test('download codeql bundle cache with pinned different version cached if "late
await codeql.setupCodeQL(
"https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz",
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",
@@ -215,8 +212,7 @@ test('download codeql bundle cache with pinned different version cached if "late
await codeql.setupCodeQL(
"latest",
"token",
"https://github.com",
sampleApiDetails,
tmpDir,
tmpDir,
"runner",

View File

@@ -160,17 +160,16 @@ function getCodeQLActionRepository(mode: util.Mode, logger: Logger): string {
}
async function getCodeQLBundleDownloadURL(
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: util.Mode,
logger: Logger
): Promise<string> {
const codeQLActionRepository = getCodeQLActionRepository(mode, logger);
const potentialDownloadSources = [
// This GitHub instance, and this Action.
[githubUrl, codeQLActionRepository],
[apiDetails.url, codeQLActionRepository],
// This GitHub instance, and the canonical Action.
[githubUrl, CODEQL_DEFAULT_ACTION_REPOSITORY],
[apiDetails.url, CODEQL_DEFAULT_ACTION_REPOSITORY],
// GitHub.com, and the canonical Action.
[util.GITHUB_DOTCOM_URL, CODEQL_DEFAULT_ACTION_REPOSITORY],
];
@@ -192,7 +191,7 @@ async function getCodeQLBundleDownloadURL(
const [repositoryOwner, repositoryName] = repository.split("/");
try {
const release = await api
.getApiClient(githubAuth, githubUrl, mode, logger, false, true)
.getApiClient(apiDetails, mode, logger, false, true)
.repos.getReleaseByTag({
owner: repositoryOwner,
repo: repositoryName,
@@ -240,8 +239,7 @@ async function toolcacheDownloadTool(
export async function setupCodeQL(
codeqlURL: string | undefined,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
tempDir: string,
toolsDir: string,
mode: util.Mode,
@@ -289,21 +287,16 @@ export async function setupCodeQL(
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
} else {
if (!codeqlURL) {
codeqlURL = await getCodeQLBundleDownloadURL(
githubAuth,
githubUrl,
mode,
logger
);
codeqlURL = await getCodeQLBundleDownloadURL(apiDetails, mode, logger);
}
const headers: IHeaders = { accept: "application/octet-stream" };
// We only want to provide an authorization header if we are downloading
// from the same GitHub instance the Action is running on.
// This avoids leaking Enterprise tokens to dotcom.
if (codeqlURL.startsWith(`${githubUrl}/`)) {
if (codeqlURL.startsWith(`${apiDetails.url}/`)) {
logger.debug("Downloading CodeQL bundle with token.");
headers.authorization = `token ${githubAuth}`;
headers.authorization = `token ${apiDetails.auth}`;
} else {
logger.debug("Downloading CodeQL bundle without token.");
}

View File

@@ -15,6 +15,11 @@ import * as util from "./util";
setupTests(test);
const sampleApiDetails = {
auth: "token",
url: "https://github.example.com",
};
// Returns the filepath of the newly-created file
function createConfigFile(inputFileContents: string, tmpDir: string): string {
const configFilePath = path.join(tmpDir, "input");
@@ -76,8 +81,7 @@ test("load empty config", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
logger
);
@@ -92,8 +96,7 @@ test("load empty config", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
logger
)
@@ -130,8 +133,7 @@ test("loading config saves config", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
logger
);
@@ -157,8 +159,7 @@ test("load input outside of workspace", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -191,8 +192,7 @@ test("load non-local input with invalid repo syntax", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -226,8 +226,7 @@ test("load non-existent input", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -311,8 +310,7 @@ test("load non-empty input", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -373,8 +371,7 @@ test("Default queries are used", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -443,8 +440,7 @@ test("Queries can be specified in config file", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -507,8 +503,7 @@ test("Queries from config file can be overridden in workflow file", async (t) =>
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -569,8 +564,7 @@ test("Queries in workflow file can be used in tandem with the 'disable default q
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -621,8 +615,7 @@ test("Multiple queries can be specified in workflow file, no config file require
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -691,8 +684,7 @@ test("Queries in workflow file can be added to the set of queries without overri
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -754,8 +746,7 @@ test("Invalid queries in workflow file handled correctly", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -817,8 +808,7 @@ test("API client used when reading remote config", async (t) => {
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -842,8 +832,7 @@ test("Remote config handles the case where a directory is provided", async (t) =
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -875,8 +864,7 @@ test("Invalid format of remote config handled correctly", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -904,8 +892,7 @@ test("No detected languages", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -930,8 +917,7 @@ test("Unknown languages", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@@ -977,8 +963,7 @@ function doInvalidInputTest(
tmpDir,
codeQL,
tmpDir,
"token",
"https://github.example.com",
sampleApiDetails,
"runner",
getRunnerLogger(true)
);

View File

@@ -591,14 +591,13 @@ export function getUnknownLanguagesError(languages: string[]): string {
*/
async function getLanguagesInRepo(
repository: RepositoryNwo,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: Mode,
logger: Logger
): Promise<Language[]> {
logger.debug(`GitHub repo ${repository.owner} ${repository.repo}`);
const response = await api
.getApiClient(githubAuth, githubUrl, mode, logger, true)
.getApiClient(apiDetails, mode, logger, true)
.repos.listLanguages({
owner: repository.owner,
repo: repository.repo,
@@ -633,8 +632,7 @@ async function getLanguagesInRepo(
async function getLanguages(
languagesInput: string | undefined,
repository: RepositoryNwo,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: Mode,
logger: Logger
): Promise<Language[]> {
@@ -647,13 +645,7 @@ async function getLanguages(
if (languages.length === 0) {
// Obtain languages as all languages in the repo that can be analysed
languages = await getLanguagesInRepo(
repository,
githubAuth,
githubUrl,
mode,
logger
);
languages = await getLanguagesInRepo(repository, apiDetails, mode, logger);
logger.info(
`Automatically detected languages: ${JSON.stringify(languages)}`
);
@@ -734,16 +726,14 @@ export async function getDefaultConfig(
toolCacheDir: string,
codeQL: CodeQL,
checkoutPath: string,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: Mode,
logger: Logger
): Promise<Config> {
const languages = await getLanguages(
languagesInput,
repository,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);
@@ -757,7 +747,7 @@ export async function getDefaultConfig(
queries,
tempDir,
checkoutPath,
githubUrl,
apiDetails.url,
logger
);
}
@@ -786,8 +776,7 @@ async function loadConfig(
toolCacheDir: string,
codeQL: CodeQL,
checkoutPath: string,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: Mode,
logger: Logger
): Promise<Config> {
@@ -798,13 +787,7 @@ async function loadConfig(
configFile = path.resolve(checkoutPath, configFile);
parsedYAML = getLocalConfig(configFile, checkoutPath);
} else {
parsedYAML = await getRemoteConfig(
configFile,
githubAuth,
githubUrl,
mode,
logger
);
parsedYAML = await getRemoteConfig(configFile, apiDetails, mode, logger);
}
// Validate that the 'name' property is syntactically correct,
@@ -821,8 +804,7 @@ async function loadConfig(
const languages = await getLanguages(
languagesInput,
repository,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);
@@ -854,7 +836,7 @@ async function loadConfig(
queries,
tempDir,
checkoutPath,
githubUrl,
apiDetails.url,
logger
);
}
@@ -879,7 +861,7 @@ async function loadConfig(
query[QUERIES_USES_PROPERTY],
tempDir,
checkoutPath,
githubUrl,
apiDetails.url,
logger,
configFile
);
@@ -961,8 +943,7 @@ export async function initConfig(
toolCacheDir: string,
codeQL: CodeQL,
checkoutPath: string,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: Mode,
logger: Logger
): Promise<Config> {
@@ -979,8 +960,7 @@ export async function initConfig(
toolCacheDir,
codeQL,
checkoutPath,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);
@@ -994,8 +974,7 @@ export async function initConfig(
toolCacheDir,
codeQL,
checkoutPath,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);
@@ -1031,8 +1010,7 @@ function getLocalConfig(configFile: string, checkoutPath: string): UserConfig {
async function getRemoteConfig(
configFile: string,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: Mode,
logger: Logger
): Promise<UserConfig> {
@@ -1047,7 +1025,7 @@ async function getRemoteConfig(
}
const response = await api
.getApiClient(githubAuth, githubUrl, mode, logger, true)
.getApiClient(apiDetails, mode, logger, true)
.repos.getContent({
owner: pieces.groups.owner,
repo: pieces.groups.repo,

View File

@@ -115,10 +115,14 @@ async function run() {
return;
}
const apiDetails = {
auth: actionsUtil.getRequiredInput("token"),
url: actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
};
const initCodeQLResult = await initCodeQL(
actionsUtil.getOptionalInput("tools"),
actionsUtil.getRequiredInput("token"),
actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
apiDetails,
actionsUtil.getRequiredEnvParam("RUNNER_TEMP"),
actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"),
"actions",
@@ -136,8 +140,7 @@ async function run() {
actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"),
codeql,
actionsUtil.getRequiredEnvParam("GITHUB_WORKSPACE"),
actionsUtil.getRequiredInput("token"),
actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
apiDetails,
"actions",
logger
);

View File

@@ -5,6 +5,7 @@ import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import * as analysisPaths from "./analysis-paths";
import { GitHubApiDetails } from "./api-client";
import { CodeQL, setupCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import { Logger } from "./logging";
@@ -14,8 +15,7 @@ import * as util from "./util";
export async function initCodeQL(
codeqlURL: string | undefined,
githubAuth: string,
githubUrl: string,
apiDetails: GitHubApiDetails,
tempDir: string,
toolsDir: string,
mode: util.Mode,
@@ -24,8 +24,7 @@ export async function initCodeQL(
logger.startGroup("Setup CodeQL tools");
const { codeql, toolsVersion } = await setupCodeQL(
codeqlURL,
githubAuth,
githubUrl,
apiDetails,
tempDir,
toolsDir,
mode,
@@ -45,8 +44,7 @@ export async function initConfig(
toolCacheDir: string,
codeQL: CodeQL,
checkoutPath: string,
githubAuth: string,
githubUrl: string,
apiDetails: GitHubApiDetails,
mode: util.Mode,
logger: Logger
): Promise<configUtils.Config> {
@@ -60,8 +58,7 @@ export async function initConfig(
toolCacheDir,
codeQL,
checkoutPath,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);

View File

@@ -146,6 +146,11 @@ program
fs.rmdirSync(tempDir, { recursive: true });
fs.mkdirSync(tempDir, { recursive: true });
const apiDetails = {
auth: cmd.githubAuth,
url: parseGithubUrl(cmd.githubUrl),
};
let codeql: CodeQL;
if (cmd.codeqlPath !== undefined) {
codeql = getCodeQL(cmd.codeqlPath);
@@ -153,8 +158,7 @@ program
codeql = (
await initCodeQL(
undefined,
cmd.githubAuth,
parseGithubUrl(cmd.githubUrl),
apiDetails,
tempDir,
toolsDir,
"runner",
@@ -172,8 +176,7 @@ program
toolsDir,
codeql,
cmd.checkoutPath || process.cwd(),
cmd.githubAuth,
parseGithubUrl(cmd.githubUrl),
apiDetails,
"runner",
logger
);
@@ -362,6 +365,12 @@ program
"Was the 'init' command run with the same '--temp-dir' argument as this command."
);
}
const apiDetails = {
auth: cmd.githubAuth,
url: parseGithubUrl(cmd.githubUrl),
};
await runAnalyze(
parseRepositoryNwo(cmd.repository),
cmd.commit,
@@ -371,8 +380,7 @@ program
undefined,
cmd.checkoutPath || process.cwd(),
undefined,
cmd.githubAuth,
parseGithubUrl(cmd.githubUrl),
apiDetails,
cmd.upload,
"runner",
outputDir,
@@ -427,6 +435,10 @@ program
.option("--debug", "Print more verbose output", false)
.action(async (cmd: UploadArgs) => {
const logger = getRunnerLogger(cmd.debug);
const apiDetails = {
auth: cmd.githubAuth,
url: parseGithubUrl(cmd.githubUrl),
};
try {
await upload_lib.upload(
cmd.sarifFile,
@@ -438,8 +450,7 @@ program
undefined,
cmd.checkoutPath || process.cwd(),
undefined,
cmd.githubAuth,
parseGithubUrl(cmd.githubUrl),
apiDetails,
"runner",
logger
);

View File

@@ -43,8 +43,7 @@ export function combineSarifFiles(sarifFiles: string[]): string {
async function uploadPayload(
payload: any,
repositoryNwo: RepositoryNwo,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: util.Mode,
logger: Logger
) {
@@ -56,7 +55,7 @@ async function uploadPayload(
return;
}
const client = api.getApiClient(githubAuth, githubUrl, mode, logger);
const client = api.getApiClient(apiDetails, mode, logger);
const reqURL =
mode === "actions"
@@ -94,8 +93,7 @@ export async function upload(
workflowRunID: number | undefined,
checkoutPath: string,
environment: string | undefined,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: util.Mode,
logger: Logger
): Promise<UploadStatusReport> {
@@ -128,8 +126,7 @@ export async function upload(
workflowRunID,
checkoutPath,
environment,
githubAuth,
githubUrl,
apiDetails,
mode,
logger
);
@@ -182,8 +179,7 @@ async function uploadFiles(
workflowRunID: number | undefined,
checkoutPath: string,
environment: string | undefined,
githubAuth: string,
githubUrl: string,
apiDetails: api.GitHubApiDetails,
mode: util.Mode,
logger: Logger
): Promise<UploadStatusReport> {
@@ -250,14 +246,7 @@ async function uploadFiles(
logger.debug(`Number of results in upload: ${numResultInSarif}`);
// Make the upload
await uploadPayload(
payload,
repositoryNwo,
githubAuth,
githubUrl,
mode,
logger
);
await uploadPayload(payload, repositoryNwo, apiDetails, mode, logger);
return {
raw_upload_size_bytes: rawUploadSizeBytes,

View File

@@ -40,6 +40,11 @@ async function run() {
}
try {
const apiDetails = {
auth: actionsUtil.getRequiredInput("token"),
url: actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
};
const uploadStats = await upload_lib.upload(
actionsUtil.getRequiredInput("sarif_file"),
parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")),
@@ -50,8 +55,7 @@ async function run() {
actionsUtil.getWorkflowRunID(),
actionsUtil.getRequiredInput("checkout_path"),
actionsUtil.getRequiredInput("matrix"),
actionsUtil.getRequiredInput("token"),
actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"),
apiDetails,
"actions",
getActionsLogger()
);