mirror of
https://github.com/github/codeql-action.git
synced 2026-04-27 17:39:15 +00:00
Load repository properties and store them in the Config
This commit is contained in:
@@ -82,11 +82,11 @@ function createTestInitConfigInputs(
|
||||
externalRepoAuth: "token",
|
||||
url: "https://github.example.com",
|
||||
apiURL: undefined,
|
||||
registriesAuthTokens: undefined,
|
||||
},
|
||||
features: createFeatures([]),
|
||||
repositoryProperties: {},
|
||||
logger: getRunnerLogger(true),
|
||||
},
|
||||
} satisfies configUtils.InitConfigInputs,
|
||||
overrides,
|
||||
);
|
||||
}
|
||||
@@ -223,6 +223,7 @@ test("load code quality config", async (t) => {
|
||||
extraQueryExclusions: [],
|
||||
overlayDatabaseMode: OverlayDatabaseMode.None,
|
||||
useOverlayDatabaseCaching: false,
|
||||
repositoryProperties: {},
|
||||
};
|
||||
|
||||
t.deepEqual(config, expectedConfig);
|
||||
@@ -461,6 +462,7 @@ test("load non-empty input", async (t) => {
|
||||
extraQueryExclusions: [],
|
||||
overlayDatabaseMode: OverlayDatabaseMode.None,
|
||||
useOverlayDatabaseCaching: false,
|
||||
repositoryProperties: {},
|
||||
};
|
||||
|
||||
const languagesInput = "javascript";
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
import { shouldPerformDiffInformedAnalysis } from "./diff-informed-analysis-utils";
|
||||
import * as errorMessages from "./error-messages";
|
||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||
import { RepositoryProperties } from "./feature-flags/properties";
|
||||
import { getGitRoot, isAnalyzingDefaultBranch } from "./git-utils";
|
||||
import { KnownLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
@@ -167,6 +168,11 @@ export interface Config {
|
||||
* `OverlayBase`.
|
||||
*/
|
||||
useOverlayDatabaseCaching: boolean;
|
||||
|
||||
/**
|
||||
* A partial mapping from repository properties that affect us to their values.
|
||||
*/
|
||||
repositoryProperties: RepositoryProperties;
|
||||
}
|
||||
|
||||
export async function getSupportedLanguageMap(
|
||||
@@ -389,6 +395,7 @@ export interface InitConfigInputs {
|
||||
githubVersion: GitHubVersion;
|
||||
apiDetails: api.GitHubApiCombinedDetails;
|
||||
features: FeatureEnablement;
|
||||
repositoryProperties: RepositoryProperties;
|
||||
logger: Logger;
|
||||
}
|
||||
|
||||
@@ -416,6 +423,7 @@ export async function initActionState(
|
||||
sourceRoot,
|
||||
githubVersion,
|
||||
features,
|
||||
repositoryProperties,
|
||||
logger,
|
||||
}: InitConfigInputs,
|
||||
userConfig: UserConfig,
|
||||
@@ -488,6 +496,7 @@ export async function initActionState(
|
||||
extraQueryExclusions: [],
|
||||
overlayDatabaseMode: OverlayDatabaseMode.None,
|
||||
useOverlayDatabaseCaching: false,
|
||||
repositoryProperties,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
} from "./diagnostics";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Feature, Features } from "./feature-flags";
|
||||
import { loadPropertiesFromApi } from "./feature-flags/properties";
|
||||
import {
|
||||
checkInstallPython311,
|
||||
checkPacksForOverlayCompatibility,
|
||||
@@ -196,6 +197,12 @@ async function run() {
|
||||
logger,
|
||||
);
|
||||
|
||||
// Fetch the values of known repository properties that affect us.
|
||||
const repositoryProperties = await loadPropertiesFromApi(
|
||||
logger,
|
||||
repositoryNwo,
|
||||
);
|
||||
|
||||
const jobRunUuid = uuidV4();
|
||||
logger.info(`Job run UUID is ${jobRunUuid}.`);
|
||||
core.exportVariable(EnvVar.JOB_RUN_UUID, jobRunUuid);
|
||||
@@ -317,6 +324,7 @@ async function run() {
|
||||
githubVersion: gitHubVersion,
|
||||
apiDetails,
|
||||
features,
|
||||
repositoryProperties,
|
||||
logger,
|
||||
});
|
||||
|
||||
|
||||
@@ -378,6 +378,7 @@ export function createTestConfig(overrides: Partial<Config>): Config {
|
||||
extraQueryExclusions: [],
|
||||
overlayDatabaseMode: OverlayDatabaseMode.None,
|
||||
useOverlayDatabaseCaching: false,
|
||||
repositoryProperties: {},
|
||||
} satisfies Config,
|
||||
overrides,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user