mirror of
https://github.com/github/codeql-action.git
synced 2026-01-06 22:50:17 +08:00
Enable database uploads for GHEC-DR
This commit is contained in:
@@ -7,7 +7,7 @@ import { Config } from "./config-utils";
|
||||
import { Logger } from "./logging";
|
||||
import { RepositoryNwo } from "./repository";
|
||||
import * as util from "./util";
|
||||
import { bundleDb } from "./util";
|
||||
import { bundleDb, parseGitHubUrl } from "./util";
|
||||
|
||||
export async function uploadDatabases(
|
||||
repositoryNwo: RepositoryNwo,
|
||||
@@ -21,8 +21,11 @@ export async function uploadDatabases(
|
||||
}
|
||||
|
||||
// Do nothing when not running against github.com
|
||||
if (config.gitHubVersion.type !== util.GitHubVariant.DOTCOM) {
|
||||
logger.debug("Not running against github.com. Skipping upload.");
|
||||
if (
|
||||
config.gitHubVersion.type !== util.GitHubVariant.DOTCOM &&
|
||||
config.gitHubVersion.type !== util.GitHubVariant.GHE_DOTCOM
|
||||
) {
|
||||
logger.debug("Not running against github.com or GHEC-DR. Skipping upload.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,6 +38,9 @@ export async function uploadDatabases(
|
||||
const client = getApiClient();
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
|
||||
const uploadsUrl = new URL(parseGitHubUrl(apiDetails.url));
|
||||
uploadsUrl.hostname = `uploads.${uploadsUrl.hostname}`;
|
||||
|
||||
for (const language of config.languages) {
|
||||
try {
|
||||
// Upload the database bundle.
|
||||
@@ -49,8 +55,9 @@ export async function uploadDatabases(
|
||||
);
|
||||
try {
|
||||
await client.request(
|
||||
`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`,
|
||||
`POST /repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`,
|
||||
{
|
||||
baseUrl: uploadsUrl.toString(),
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
|
||||
Reference in New Issue
Block a user