mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +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,
|
languages,
|
||||||
packsInputCombines
|
packsInputCombines
|
||||||
);
|
);
|
||||||
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
const queries = parseQueriesInput(rawQueriesInput);
|
||||||
const queriesInput = parseQueriesFromInput(
|
const repoPropertyQueries = parseExtraQueriesProperty(
|
||||||
rawQueriesInput,
|
repositoryProperties["github-codeql-extra-queries" /* EXTRA_QUERIES */]
|
||||||
queriesInputCombines
|
|
||||||
);
|
);
|
||||||
const repoExtraQueries = repositoryProperties["github-codeql-extra-queries" /* EXTRA_QUERIES */];
|
return {
|
||||||
const repoExtraQueriesCombines = shouldCombine(repoExtraQueries);
|
packsInputCombines,
|
||||||
const repoPropertyQueries = {
|
packsInput: packsInput?.[languages[0]],
|
||||||
combines: repoExtraQueriesCombines,
|
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(
|
input: parseQueriesFromInput(
|
||||||
repoExtraQueries,
|
value,
|
||||||
repoExtraQueriesCombines,
|
combines,
|
||||||
new ConfigurationError(
|
new ConfigurationError(
|
||||||
getRepoPropertyError(
|
getRepoPropertyError(
|
||||||
"github-codeql-extra-queries" /* EXTRA_QUERIES */,
|
"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) {
|
function parseQueriesFromInput(rawQueriesInput, queriesInputCombines, errorToThrow) {
|
||||||
if (!rawQueriesInput) {
|
if (!rawQueriesInput) {
|
||||||
|
|||||||
@@ -446,20 +446,53 @@ export async function calculateAugmentation(
|
|||||||
languages,
|
languages,
|
||||||
packsInputCombines,
|
packsInputCombines,
|
||||||
);
|
);
|
||||||
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
const queries = parseQueriesInput(rawQueriesInput);
|
||||||
const queriesInput = parseQueriesFromInput(
|
const repoPropertyQueries = parseExtraQueriesProperty(
|
||||||
rawQueriesInput,
|
repositoryProperties[RepositoryPropertyName.EXTRA_QUERIES],
|
||||||
queriesInputCombines,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const repoExtraQueries =
|
return {
|
||||||
repositoryProperties[RepositoryPropertyName.EXTRA_QUERIES];
|
packsInputCombines,
|
||||||
const repoExtraQueriesCombines = shouldCombine(repoExtraQueries);
|
packsInput: packsInput?.[languages[0]],
|
||||||
const repoPropertyQueries = {
|
queriesInput: queries.input,
|
||||||
combines: repoExtraQueriesCombines,
|
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(
|
input: parseQueriesFromInput(
|
||||||
repoExtraQueries,
|
value,
|
||||||
repoExtraQueriesCombines,
|
combines,
|
||||||
new ConfigurationError(
|
new ConfigurationError(
|
||||||
errorMessages.getRepoPropertyError(
|
errorMessages.getRepoPropertyError(
|
||||||
RepositoryPropertyName.EXTRA_QUERIES,
|
RepositoryPropertyName.EXTRA_QUERIES,
|
||||||
@@ -468,14 +501,6 @@ export async function calculateAugmentation(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
|
||||||
packsInputCombines,
|
|
||||||
packsInput: packsInput?.[languages[0]],
|
|
||||||
queriesInput,
|
|
||||||
queriesInputCombines,
|
|
||||||
repoPropertyQueries,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseQueriesFromInput(
|
function parseQueriesFromInput(
|
||||||
|
|||||||
Reference in New Issue
Block a user