mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Extract parsing of the queries input and the extra queries repository property
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
41
lib/entry-points.js
generated
41
lib/entry-points.js
generated
@@ -149430,18 +149430,32 @@ async function calculateAugmentation(rawPacksInput, rawQueriesInput, repositoryP
|
||||
languages,
|
||||
packsInputCombines
|
||||
);
|
||||
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
||||
const queriesInput = parseQueriesFromInput(
|
||||
rawQueriesInput,
|
||||
queriesInputCombines
|
||||
const queries = parseQueriesInput(rawQueriesInput);
|
||||
const repoPropertyQueries = parseExtraQueriesProperty(
|
||||
repositoryProperties["github-codeql-extra-queries" /* EXTRA_QUERIES */]
|
||||
);
|
||||
const repoExtraQueries = repositoryProperties["github-codeql-extra-queries" /* EXTRA_QUERIES */];
|
||||
const repoExtraQueriesCombines = shouldCombine(repoExtraQueries);
|
||||
const repoPropertyQueries = {
|
||||
combines: repoExtraQueriesCombines,
|
||||
return {
|
||||
packsInputCombines,
|
||||
packsInput: packsInput?.[languages[0]],
|
||||
queriesInput: queries.input,
|
||||
queriesInputCombines: queries.combines,
|
||||
repoPropertyQueries
|
||||
};
|
||||
}
|
||||
function parseQueriesInput(rawQueriesInput) {
|
||||
const combines = shouldCombine(rawQueriesInput);
|
||||
return {
|
||||
combines,
|
||||
input: parseQueriesFromInput(rawQueriesInput, combines)
|
||||
};
|
||||
}
|
||||
function parseExtraQueriesProperty(value) {
|
||||
const combines = shouldCombine(value);
|
||||
return {
|
||||
combines,
|
||||
input: parseQueriesFromInput(
|
||||
repoExtraQueries,
|
||||
repoExtraQueriesCombines,
|
||||
value,
|
||||
combines,
|
||||
new ConfigurationError(
|
||||
getRepoPropertyError(
|
||||
"github-codeql-extra-queries" /* EXTRA_QUERIES */,
|
||||
@@ -149450,13 +149464,6 @@ async function calculateAugmentation(rawPacksInput, rawQueriesInput, repositoryP
|
||||
)
|
||||
)
|
||||
};
|
||||
return {
|
||||
packsInputCombines,
|
||||
packsInput: packsInput?.[languages[0]],
|
||||
queriesInput,
|
||||
queriesInputCombines,
|
||||
repoPropertyQueries
|
||||
};
|
||||
}
|
||||
function parseQueriesFromInput(rawQueriesInput, queriesInputCombines, errorToThrow) {
|
||||
if (!rawQueriesInput) {
|
||||
|
||||
@@ -446,20 +446,53 @@ export async function calculateAugmentation(
|
||||
languages,
|
||||
packsInputCombines,
|
||||
);
|
||||
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
||||
const queriesInput = parseQueriesFromInput(
|
||||
rawQueriesInput,
|
||||
queriesInputCombines,
|
||||
const queries = parseQueriesInput(rawQueriesInput);
|
||||
const repoPropertyQueries = parseExtraQueriesProperty(
|
||||
repositoryProperties[RepositoryPropertyName.EXTRA_QUERIES],
|
||||
);
|
||||
|
||||
const repoExtraQueries =
|
||||
repositoryProperties[RepositoryPropertyName.EXTRA_QUERIES];
|
||||
const repoExtraQueriesCombines = shouldCombine(repoExtraQueries);
|
||||
const repoPropertyQueries = {
|
||||
combines: repoExtraQueriesCombines,
|
||||
return {
|
||||
packsInputCombines,
|
||||
packsInput: packsInput?.[languages[0]],
|
||||
queriesInput: queries.input,
|
||||
queriesInputCombines: queries.combines,
|
||||
repoPropertyQueries,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the `queries` input, a comma-separated list of queries that's combined with the queries
|
||||
* from the configuration if it starts with '+'. The `input` of the result is `undefined` if the
|
||||
* value is unset or empty. Entries aren't validated, so an empty entry becomes `{ uses: "" }`.
|
||||
*
|
||||
* @throws A `ConfigurationError` if the input is a '+' with no queries after it.
|
||||
*/
|
||||
export function parseQueriesInput(
|
||||
rawQueriesInput: string | undefined,
|
||||
): Augmentation<QuerySpec[]> {
|
||||
const combines = shouldCombine(rawQueriesInput);
|
||||
return {
|
||||
combines,
|
||||
input: parseQueriesFromInput(rawQueriesInput, combines),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the `github-codeql-extra-queries` repository property, which has the same format as the
|
||||
* `queries` input. The `input` of the result is `undefined` if the value is unset or empty. Entries
|
||||
* aren't validated, so an empty entry becomes `{ uses: "" }`.
|
||||
*
|
||||
* @throws A `ConfigurationError` if the value is a '+' with no queries after it.
|
||||
*/
|
||||
export function parseExtraQueriesProperty(
|
||||
value: string | undefined,
|
||||
): Augmentation<QuerySpec[]> {
|
||||
const combines = shouldCombine(value);
|
||||
return {
|
||||
combines,
|
||||
input: parseQueriesFromInput(
|
||||
repoExtraQueries,
|
||||
repoExtraQueriesCombines,
|
||||
value,
|
||||
combines,
|
||||
new ConfigurationError(
|
||||
errorMessages.getRepoPropertyError(
|
||||
RepositoryPropertyName.EXTRA_QUERIES,
|
||||
@@ -468,14 +501,6 @@ export async function calculateAugmentation(
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
return {
|
||||
packsInputCombines,
|
||||
packsInput: packsInput?.[languages[0]],
|
||||
queriesInput,
|
||||
queriesInputCombines,
|
||||
repoPropertyQueries,
|
||||
};
|
||||
}
|
||||
|
||||
function parseQueriesFromInput(
|
||||
|
||||
Reference in New Issue
Block a user