Gate changes behind new format FF

This commit is contained in:
Michael B. Gale
2026-07-15 16:14:55 +01:00
parent decb87044a
commit 247ce88c8f
2 changed files with 15 additions and 8 deletions

11
lib/entry-points.js generated
View File

@@ -149241,7 +149241,10 @@ async function downloadCacheWithTime(codeQL, languages, logger) {
return { trapCaches, trapCacheDownloadTime };
}
async function loadUserConfig(actionState, configFile, workspacePath, apiDetails, tempDir) {
if (isLocal(configFile)) {
const allowNewFormat = await actionState.features.getValue(
"new_remote_file_addresses" /* NewRemoteFileAddresses */
);
if (isLocal(configFile, allowNewFormat)) {
if (configFile !== userConfigFromActionPath(tempDir)) {
configFile = path10.resolve(workspacePath, configFile);
if (!(configFile + path10.sep).startsWith(workspacePath + path10.sep)) {
@@ -149255,7 +149258,7 @@ async function loadUserConfig(actionState, configFile, workspacePath, apiDetails
);
return getLocalConfig(actionState.logger, configFile, validateConfig);
} else {
if (isExplicitRemotePath(configFile)) {
if (allowNewFormat && isExplicitRemotePath(configFile)) {
configFile = configFile.substring(REMOTE_PATH_PREFIX.length);
}
return await getRemoteConfig(actionState, configFile, apiDetails);
@@ -149726,11 +149729,11 @@ function isExplicitRemotePath(configPath) {
function containsAtRef(configPath) {
return configPath.includes("@");
}
function isLocal(configPath) {
function isLocal(configPath, allowNewFormat) {
if (isExplicitLocalPath(configPath)) {
return true;
}
if (isExplicitRemotePath(configPath)) {
if (allowNewFormat && isExplicitRemotePath(configPath)) {
return false;
}
return !containsAtRef(configPath);

View File

@@ -489,7 +489,11 @@ export async function loadUserConfig(
apiDetails: api.GitHubApiCombinedDetails,
tempDir: string,
): Promise<UserConfig> {
if (isLocal(configFile)) {
const allowNewFormat = await actionState.features.getValue(
Feature.NewRemoteFileAddresses,
);
if (isLocal(configFile, allowNewFormat)) {
if (configFile !== userConfigFromActionPath(tempDir)) {
// If the config file is not generated by the Action, it should be relative to the workspace.
configFile = path.resolve(workspacePath, configFile);
@@ -508,7 +512,7 @@ export async function loadUserConfig(
// Drop the explicit prefix if it is present. Since `REMOTE_PATH_PREFIX` is chosen
// to not conflict with permissible characters in "owner" or "repo" components,
// this does not risk removing valid parts of either component by accident.
if (isExplicitRemotePath(configFile)) {
if (allowNewFormat && isExplicitRemotePath(configFile)) {
configFile = configFile.substring(REMOTE_PATH_PREFIX.length);
}
return await getRemoteConfig(actionState, configFile, apiDetails);
@@ -1322,7 +1326,7 @@ function containsAtRef(configPath: string): boolean {
* @param configPath The path to test.
* @returns True if it is local, or false otherwise.
*/
function isLocal(configPath: string): boolean {
function isLocal(configPath: string, allowNewFormat: boolean): boolean {
// If the path starts with `LOCAL_PATH_PREFIX`, it is explicitly local.
// This allows local paths that would otherwise contain '@'
// to be used with a `LOCAL_PATH_PREFIX` prefix.
@@ -1331,7 +1335,7 @@ function isLocal(configPath: string): boolean {
}
// If the path starts with `REMOTE_PATH_PREFIX`, it is explicitly remote.
// This allows users to resolve ambiguity by specifying `REMOTE_PATH_PREFIX`.
if (isExplicitRemotePath(configPath)) {
if (allowNewFormat && isExplicitRemotePath(configPath)) {
return false;
}