Skip to content

Commit 127851b

Browse files
committed
Add environment variable for skipping workflow validation
1 parent 8d77149 commit 127851b

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

‎lib/init-action.js‎

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/environment.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,10 @@ export enum EnvVar {
137137
* This setting is more specific than `CODEQL_ACTION_TEST_MODE`, which implies this option.
138138
*/
139139
SKIP_SARIF_UPLOAD = "CODEQL_ACTION_SKIP_SARIF_UPLOAD",
140+
141+
/**
142+
* Whether to skip workflow validation. Intended for internal use, where we know that
143+
* the workflow is valid and validation is not necessary.
144+
*/
145+
SKIP_WORKFLOW_VALIDATION = "CODEQL_ACTION_SKIP_WORKFLOW_VALIDATION",
140146
}

‎src/init-action.ts‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,19 @@ async function run() {
288288
toolsSource = initCodeQLResult.toolsSource;
289289
zstdAvailability = initCodeQLResult.zstdAvailability;
290290

291-
core.startGroup("Validating workflow");
292-
const validateWorkflowResult = await validateWorkflow(codeql, logger);
293-
if (validateWorkflowResult === undefined) {
294-
logger.info("Detected no issues with the code scanning workflow.");
295-
} else {
296-
logger.warning(
297-
`Unable to validate code scanning workflow: ${validateWorkflowResult}`,
298-
);
291+
// Check the workflow for problems, unless `SKIP_WORKFLOW_VALIDATION` is `true`.
292+
if (process.env[EnvVar.SKIP_WORKFLOW_VALIDATION] !== "true") {
293+
core.startGroup("Validating workflow");
294+
const validateWorkflowResult = await validateWorkflow(codeql, logger);
295+
if (validateWorkflowResult === undefined) {
296+
logger.info("Detected no issues with the code scanning workflow.");
297+
} else {
298+
logger.warning(
299+
`Unable to validate code scanning workflow: ${validateWorkflowResult}`,
300+
);
301+
}
302+
core.endGroup();
299303
}
300-
core.endGroup();
301304

302305
// Set CODEQL_ENABLE_EXPERIMENTAL_FEATURES for Rust if between 2.19.3 (included) and 2.22.1 (excluded)
303306
// We need to set this environment variable before initializing the config, otherwise Rust

0 commit comments

Comments
 (0)