Log error for non-default analysis-kinds input outside of managed workflows

This commit is contained in:
Michael B. Gale
2026-05-13 17:43:16 +01:00
parent 3d6ea97f26
commit 4235601f6f
5 changed files with 147 additions and 13 deletions

18
lib/init-action.js generated
View File

@@ -87589,6 +87589,12 @@ async function parseAnalysisKinds(input) {
);
}
var cachedAnalysisKinds;
function isOnlyCodeScanningEnabled(analysisKinds) {
return analysisKinds.length === 1 && analysisKinds[0] === "code-scanning" /* CodeScanning */;
}
function makeAnalysisKindUsageError(message) {
return `The \`analysis-kinds\` input is experimental and for GitHub-internal use only. Its behaviour may change at any time or be removed entirely. ${message}`;
}
async function getAnalysisKinds(logger, features, skipCache = false) {
if (!skipCache && cachedAnalysisKinds !== void 0) {
return cachedAnalysisKinds;
@@ -87596,6 +87602,14 @@ async function getAnalysisKinds(logger, features, skipCache = false) {
const analysisKinds = await parseAnalysisKinds(
getRequiredInput("analysis-kinds")
);
if (!isInTestMode() && !isDynamicWorkflow() && !isOnlyCodeScanningEnabled(analysisKinds)) {
const codeQualityHint = analysisKinds.includes("code-quality" /* CodeQuality */) ? " If your intention is to use quality queries outside of Code Quality, use the `queries` input with `code-quality` instead." : "";
logger.error(
makeAnalysisKindUsageError(
`An analysis kind other than \`code-scanning\` was specified in a custom workflow. This is not supported and will become a fatal error in a future version of the CodeQL Action.${codeQualityHint}`
)
);
}
const qualityQueriesInput = getOptionalInput("quality-queries");
if (qualityQueriesInput !== void 0) {
logger.warning(
@@ -87617,7 +87631,9 @@ async function getAnalysisKinds(logger, features, skipCache = false) {
}
if (!isInTestMode() && analysisKinds.length > 1 && !await features.getValue("allow_multiple_analysis_kinds" /* AllowMultipleAnalysisKinds */)) {
logger.error(
"The `analysis-kinds` input is experimental and for GitHub-internal use only. Its behaviour may change at any time or be removed entirely. Specifying multiple values as input is no longer supported. Continuing with only `analysis-kinds: code-scanning`."
makeAnalysisKindUsageError(
"Specifying multiple values as input is no longer supported. Continuing with only `analysis-kinds: code-scanning`."
)
);
cachedAnalysisKinds = ["code-scanning" /* CodeScanning */];
return cachedAnalysisKinds;

View File

@@ -87029,6 +87029,12 @@ async function parseAnalysisKinds(input) {
);
}
var cachedAnalysisKinds;
function isOnlyCodeScanningEnabled(analysisKinds) {
return analysisKinds.length === 1 && analysisKinds[0] === "code-scanning" /* CodeScanning */;
}
function makeAnalysisKindUsageError(message) {
return `The \`analysis-kinds\` input is experimental and for GitHub-internal use only. Its behaviour may change at any time or be removed entirely. ${message}`;
}
async function getAnalysisKinds(logger, features, skipCache = false) {
if (!skipCache && cachedAnalysisKinds !== void 0) {
return cachedAnalysisKinds;
@@ -87036,6 +87042,14 @@ async function getAnalysisKinds(logger, features, skipCache = false) {
const analysisKinds = await parseAnalysisKinds(
getRequiredInput("analysis-kinds")
);
if (!isInTestMode() && !isDynamicWorkflow() && !isOnlyCodeScanningEnabled(analysisKinds)) {
const codeQualityHint = analysisKinds.includes("code-quality" /* CodeQuality */) ? " If your intention is to use quality queries outside of Code Quality, use the `queries` input with `code-quality` instead." : "";
logger.error(
makeAnalysisKindUsageError(
`An analysis kind other than \`code-scanning\` was specified in a custom workflow. This is not supported and will become a fatal error in a future version of the CodeQL Action.${codeQualityHint}`
)
);
}
const qualityQueriesInput = getOptionalInput("quality-queries");
if (qualityQueriesInput !== void 0) {
logger.warning(
@@ -87057,7 +87071,9 @@ async function getAnalysisKinds(logger, features, skipCache = false) {
}
if (!isInTestMode() && analysisKinds.length > 1 && !await features.getValue("allow_multiple_analysis_kinds" /* AllowMultipleAnalysisKinds */)) {
logger.error(
"The `analysis-kinds` input is experimental and for GitHub-internal use only. Its behaviour may change at any time or be removed entirely. Specifying multiple values as input is no longer supported. Continuing with only `analysis-kinds: code-scanning`."
makeAnalysisKindUsageError(
"Specifying multiple values as input is no longer supported. Continuing with only `analysis-kinds: code-scanning`."
)
);
cachedAnalysisKinds = ["code-scanning" /* CodeScanning */];
return cachedAnalysisKinds;