mirror of
https://github.com/github/codeql-action.git
synced 2025-12-31 11:40:24 +08:00
Add support for downloading packs from GHES
This change adds:
- new `registries` block allowed in code scanning config file
- new `registries-auth-tokens` input in init action
- Change the downloadPacks function so that it accepts new parameters:
- registries block
- api auth
- Generate a qlconfig.yml file with the registries block if one is
supplied. Use this file when downloading packs.
- temporarily set the `GITHUB_TOKEN` and `CODEQL_REGISTRIES_AUTH` based
on api auth
TODO:
1. integration test
2. handle pack downloads when the config is generated by the CLI
This commit is contained in:
@@ -134,7 +134,10 @@ export interface CodeQL {
|
||||
/**
|
||||
* Run 'codeql pack download'.
|
||||
*/
|
||||
packDownload(packs: string[]): Promise<PackDownloadOutput>;
|
||||
packDownload(
|
||||
packs: string[],
|
||||
qlconfigFile: string | undefined
|
||||
): Promise<PackDownloadOutput>;
|
||||
|
||||
/**
|
||||
* Run 'codeql database cleanup'.
|
||||
@@ -1086,11 +1089,22 @@ async function getCodeQLForCmd(
|
||||
* If no version is specified, then the latest version is
|
||||
* downloaded. The check to determine what the latest version is is done
|
||||
* each time this package is requested.
|
||||
*
|
||||
* Optionally, a `qlconfigFile` is included. If used, then this file
|
||||
* is used to determine which registry each pack is downloaded from.
|
||||
*/
|
||||
async packDownload(packs: string[]): Promise<PackDownloadOutput> {
|
||||
async packDownload(
|
||||
packs: string[],
|
||||
qlconfigFile: string | undefined
|
||||
): Promise<PackDownloadOutput> {
|
||||
const qlconfigArg = qlconfigFile
|
||||
? [`--qlconfig-file=${qlconfigFile}`]
|
||||
: ([] as string[]);
|
||||
|
||||
const codeqlArgs = [
|
||||
"pack",
|
||||
"download",
|
||||
...qlconfigArg,
|
||||
"--format=json",
|
||||
"--resolve-query-specs",
|
||||
...getExtraOptionsFromEnv(["pack", "download"]),
|
||||
|
||||
Reference in New Issue
Block a user