Skip checks on self-hosted runners

This commit is contained in:
Michael B. Gale
2026-10-29 16:28:51 +00:00
parent ad2b30ba0f
commit 8cafec0756
3 changed files with 42 additions and 1 deletions

3
lib/entry-points.js generated
View File

@@ -193986,6 +193986,9 @@ async function checkRunnerSupportsTracedAnalysis(action, config, codeql) {
if (!await action.features.getValue("check_unsupported_traced_analysis" /* CheckUnsupportedTracedAnalysis */)) {
return;
}
if (isSelfHostedRunner(action.env)) {
return;
}
if (config.buildMode !== void 0 && config.buildMode === "none") {
return;
}

View File

@@ -170,6 +170,38 @@ test("checkRunnerSupportsTracedAnalysis doesn't perform checks if FF is not enab
]);
}));
test("checkRunnerSupportsTracedAnalysis doesn't perform checks on self-hosted runners", async (t) =>
withTmpDir(async (tmpDir) => {
const logger = new RecordingLogger();
const env = getTestEnv();
env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir);
env.set(ActionsEnvVars.RUNNER_ENVIRONMENT, "self-hosted");
const features = createFeatures([Feature.CheckUnsupportedTracedAnalysis]);
const codeql = await getCodeQLWithTracedStub(
"codeql-for-testing",
logger,
env,
);
sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0"));
await checkRunnerSupportsTracedAnalysis(
initAllState({
logger,
platform: "darwin",
osRelease: "unexpected",
env,
features,
}),
createTestConfig({ languages: [BuiltInLanguage.go] }),
codeql,
);
checkUnexpectedLogMessages(t, logger.messages, [
"Unable to determine version of macOS, got: unexpected",
]);
}));
test("checkRunnerSupportsTracedAnalysis warns if version string is not a semver", async (t) =>
withTmpDir(async (tmpDir) => {
const logger = new RecordingLogger();

View File

@@ -1,6 +1,7 @@
import * as semver from "semver";
import type { ActionState, Logger } from "../action-common";
import { isSelfHostedRunner } from "../actions-util";
import type { CodeQL } from "../codeql";
import type { ActionConfig } from "../config/action-config";
import { addDiagnostic, makeDiagnostic } from "../diagnostics";
@@ -115,7 +116,7 @@ export async function hasTracedLanguages(
* @throws {ConfigurationError} If traced analysis is not possible on the current runner.
*/
export async function checkRunnerSupportsTracedAnalysis(
action: ActionState<["Base", "Logger", "FeatureFlags"]>,
action: ActionState<["Base", "Env", "Logger", "FeatureFlags"]>,
config: ActionConfig<"languages" | "dbLocation" | "tempDir">,
codeql: CodeQL,
) {
@@ -132,6 +133,11 @@ export async function checkRunnerSupportsTracedAnalysis(
return;
}
// Skip if we are on a self-hosted runner.
if (isSelfHostedRunner(action.env)) {
return;
}
// `build-mode: none` doesn't use the tracer, so it is always supported.
if (config.buildMode !== undefined && config.buildMode === "none") {
return;