mirror of
https://github.com/github/codeql-action.git
synced 2026-04-16 11:43:18 +00:00
Ensure qlconfig file is created when config parsing in cli is on
Previously, with the config parsing in the cli feature flag turned on, the CLI was not able to download packs from other registries. This PR adds the codeql-action changes required for this. The CLI changes will be in a separate, internal PR.
This commit is contained in:
39
src/init.ts
39
src/init.ts
@@ -104,20 +104,45 @@ export async function runInit(
|
||||
config: configUtils.Config,
|
||||
sourceRoot: string,
|
||||
processName: string | undefined,
|
||||
registriesInput: string | undefined,
|
||||
featureEnablement: FeatureEnablement,
|
||||
apiDetails: GitHubApiCombinedDetails,
|
||||
logger: Logger
|
||||
): Promise<TracerConfig | undefined> {
|
||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||
|
||||
try {
|
||||
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
|
||||
// Init a database cluster
|
||||
await codeql.databaseInitCluster(
|
||||
config,
|
||||
sourceRoot,
|
||||
processName,
|
||||
featureEnablement,
|
||||
logger
|
||||
// Only create the qlconfig file if we haven't already created it.
|
||||
// If we are not parsing the config file in the cli, then the qlconfig
|
||||
// file has already been created.
|
||||
let registriesAuthTokens: string | undefined;
|
||||
let qlconfigFile: string | undefined;
|
||||
if (await util.useCodeScanningConfigInCli(codeql, featureEnablement)) {
|
||||
({ registriesAuthTokens, qlconfigFile } =
|
||||
await configUtils.generateRegistries(
|
||||
registriesInput,
|
||||
codeql,
|
||||
config.tempDir,
|
||||
logger
|
||||
));
|
||||
}
|
||||
await configUtils.wrapEnvironment(
|
||||
{
|
||||
GITHUB_TOKEN: apiDetails.auth,
|
||||
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
|
||||
},
|
||||
|
||||
// Init a database cluster
|
||||
async () =>
|
||||
await codeql.databaseInitCluster(
|
||||
config,
|
||||
sourceRoot,
|
||||
processName,
|
||||
featureEnablement,
|
||||
qlconfigFile,
|
||||
logger
|
||||
)
|
||||
);
|
||||
} else {
|
||||
for (const language of config.languages) {
|
||||
|
||||
Reference in New Issue
Block a user