mirror of
https://github.com/github/codeql-action.git
synced 2025-12-28 10:10:17 +08:00
Add resolveQueriesStartingPacks()
This commit is contained in:
@@ -198,6 +198,10 @@ export interface CodeQL {
|
||||
): Promise<void>;
|
||||
/** Get the location of an extractor for the specified language. */
|
||||
resolveExtractor(language: Language): Promise<string>;
|
||||
/**
|
||||
* Run 'codeql resolve queries --format=startingpacks'.
|
||||
*/
|
||||
resolveQueriesStartingPacks(queries: string[]): Promise<string[]>;
|
||||
/**
|
||||
* Run 'codeql github merge-results'.
|
||||
*/
|
||||
@@ -479,6 +483,10 @@ export function createStubCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
||||
),
|
||||
diagnosticsExport: resolveFunction(partialCodeql, "diagnosticsExport"),
|
||||
resolveExtractor: resolveFunction(partialCodeql, "resolveExtractor"),
|
||||
resolveQueriesStartingPacks: resolveFunction(
|
||||
partialCodeql,
|
||||
"resolveQueriesStartingPacks",
|
||||
),
|
||||
mergeResults: resolveFunction(partialCodeql, "mergeResults"),
|
||||
};
|
||||
}
|
||||
@@ -974,6 +982,24 @@ export async function getCodeQLForCmd(
|
||||
).exec();
|
||||
return JSON.parse(extractorPath) as string;
|
||||
},
|
||||
async resolveQueriesStartingPacks(queries: string[]): Promise<string[]> {
|
||||
const codeqlArgs = [
|
||||
"resolve",
|
||||
"queries",
|
||||
"--format=startingpacks",
|
||||
...getExtraOptionsFromEnv(["resolve", "queries"]),
|
||||
...queries,
|
||||
];
|
||||
const output = await runCli(cmd, codeqlArgs, { noStreamStdout: true });
|
||||
|
||||
try {
|
||||
return JSON.parse(output) as string[];
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`Unexpected output from codeql resolve queries --format=startingpacks: ${e}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
async mergeResults(
|
||||
sarifFiles: string[],
|
||||
outputFile: string,
|
||||
|
||||
Reference in New Issue
Block a user