mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Return OfflineFeatures for CCR
This commit is contained in:
6
lib/analyze-action.js
generated
6
lib/analyze-action.js
generated
@@ -108115,7 +108115,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/diff-informed-analysis-utils.ts
|
||||
|
||||
10
lib/autobuild-action.js
generated
10
lib/autobuild-action.js
generated
@@ -103130,6 +103130,10 @@ function getWorkflowRunAttempt() {
|
||||
function isSelfHostedRunner() {
|
||||
return process.env.RUNNER_ENVIRONMENT === "self-hosted";
|
||||
}
|
||||
var CCR_KEY_PREFIX = "dynamic/copilot-pull-request-reviewer";
|
||||
function isCCR() {
|
||||
return process.env["CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */]?.startsWith(CCR_KEY_PREFIX) || false;
|
||||
}
|
||||
function prettyPrintInvocation(cmd, args) {
|
||||
return [cmd, ...args].map((x) => x.includes(" ") ? `'${x}'` : x).join(" ");
|
||||
}
|
||||
@@ -104448,7 +104452,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/trap-caching.ts
|
||||
|
||||
6
lib/init-action-post.js
generated
6
lib/init-action-post.js
generated
@@ -165441,7 +165441,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/diff-informed-analysis-utils.ts
|
||||
|
||||
6
lib/init-action.js
generated
6
lib/init-action.js
generated
@@ -105648,7 +105648,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/diff-informed-analysis-utils.ts
|
||||
|
||||
10
lib/setup-codeql-action.js
generated
10
lib/setup-codeql-action.js
generated
@@ -103247,6 +103247,10 @@ function isSelfHostedRunner() {
|
||||
function isDynamicWorkflow() {
|
||||
return getWorkflowEventName() === "dynamic";
|
||||
}
|
||||
var CCR_KEY_PREFIX = "dynamic/copilot-pull-request-reviewer";
|
||||
function isCCR() {
|
||||
return process.env["CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */]?.startsWith(CCR_KEY_PREFIX) || false;
|
||||
}
|
||||
function prettyPrintInvocation(cmd, args) {
|
||||
return [cmd, ...args].map((x) => x.includes(" ") ? `'${x}'` : x).join(" ");
|
||||
}
|
||||
@@ -104349,7 +104353,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/init.ts
|
||||
|
||||
10
lib/start-proxy-action.js
generated
10
lib/start-proxy-action.js
generated
@@ -120267,6 +120267,10 @@ function getWorkflowRunAttempt() {
|
||||
function isSelfHostedRunner() {
|
||||
return process.env.RUNNER_ENVIRONMENT === "self-hosted";
|
||||
}
|
||||
var CCR_KEY_PREFIX = "dynamic/copilot-pull-request-reviewer";
|
||||
function isCCR() {
|
||||
return process.env["CODEQL_ACTION_ANALYSIS_KEY" /* ANALYSIS_KEY */]?.startsWith(CCR_KEY_PREFIX) || false;
|
||||
}
|
||||
var persistedInputsKey = "persisted_inputs";
|
||||
var persistInputs = function() {
|
||||
const inputEnvironmentVariables = Object.entries(process.env).filter(
|
||||
@@ -121142,7 +121146,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/start-proxy.ts
|
||||
|
||||
6
lib/upload-sarif-action.js
generated
6
lib/upload-sarif-action.js
generated
@@ -107303,7 +107303,11 @@ function supportsFeatureFlags(githubVariant) {
|
||||
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
|
||||
}
|
||||
function initFeatures(gitHubVersion, repositoryNwo, tempDir, logger) {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
// src/status-report.ts
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as path from "path";
|
||||
import test, { ExecutionContext } from "ava";
|
||||
|
||||
import * as defaults from "./defaults.json";
|
||||
import { EnvVar } from "./environment";
|
||||
import {
|
||||
Feature,
|
||||
featureConfig,
|
||||
@@ -542,6 +543,22 @@ test("non-legacy feature flags should not start with codeql_action_", async (t)
|
||||
}
|
||||
});
|
||||
|
||||
test("initFeatures returns a `Features` instance by default", async (t) => {
|
||||
await withTmpDir(async (tmpDir) => {
|
||||
const features = setUpFeatureFlagTests(tmpDir);
|
||||
t.is("Features", features.constructor.name);
|
||||
});
|
||||
});
|
||||
|
||||
test("initFeatures returns an `OfflineFeatures` instance in CCR", async (t) => {
|
||||
await withTmpDir(async (tmpDir) => {
|
||||
process.env.GITHUB_EVENT_NAME = "dynamic";
|
||||
process.env[EnvVar.ANALYSIS_KEY] = "dynamic/copilot-pull-request-reviewer";
|
||||
const features = setUpFeatureFlagTests(tmpDir);
|
||||
t.is("OfflineFeatures", features.constructor.name);
|
||||
});
|
||||
});
|
||||
|
||||
function assertAllFeaturesUndefinedInApi(
|
||||
t: ExecutionContext<unknown>,
|
||||
loggedMessages: LoggedMessage[],
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as path from "path";
|
||||
|
||||
import * as semver from "semver";
|
||||
|
||||
import { isCCR } from "./actions-util";
|
||||
import { getApiClient } from "./api-client";
|
||||
import type { CodeQL } from "./codeql";
|
||||
import * as defaults from "./defaults.json";
|
||||
@@ -809,5 +810,9 @@ export function initFeatures(
|
||||
tempDir: string,
|
||||
logger: Logger,
|
||||
): FeatureEnablement {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
if (isCCR()) {
|
||||
return new OfflineFeatures(logger);
|
||||
} else {
|
||||
return new Features(gitHubVersion, repositoryNwo, tempDir, logger);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user