Gate new remote file format behind FF

This commit is contained in:
Michael B. Gale
2026-06-30 13:19:30 +01:00
parent 7b2af8940d
commit b6be81d5b9
5 changed files with 262 additions and 240 deletions

19
lib/entry-points.js generated
View File

@@ -151056,6 +151056,11 @@ function getInvalidConfigFileMessage(configFile, messages) {
const andMore = messages.length > 10 ? `, and ${messages.length - 10} more.` : ".";
return `The configuration file "${configFile}" is invalid: ${messages.slice(0, 10).join(", ")}${andMore}`;
}
function getConfigFileRepoOldFormatInvalidMessage(configFile) {
let error3 = `The configuration file "${configFile}" is not a supported remote file reference.`;
error3 += " Expected format <owner>/<repository>/<file-path>@<ref>";
return error3;
}
function getConfigFileRepoFormatInvalidMessage(configFile) {
let error3 = `The configuration file "${configFile}" is not a supported remote file reference.`;
error3 += " Expected format [<owner>/]<repository>[@<ref>][:<file-path>]";
@@ -151467,11 +151472,19 @@ function parseOldRemoteFileAddress(input) {
ref: pieces.groups.ref.trim()
});
}
function parseRemoteFileAddress(env, configFile) {
async function parseRemoteFileAddress(actionState, configFile) {
const oldFormatAddressResult = parseOldRemoteFileAddress(configFile);
if (oldFormatAddressResult.isSuccess()) {
return oldFormatAddressResult.value;
}
const allowNewFormat = await actionState.features.getValue(
"new_remote_file_addresses" /* NewRemoteFileAddresses */
);
if (!allowNewFormat) {
throw new ConfigurationError(
getConfigFileRepoOldFormatInvalidMessage(configFile)
);
}
const format = new RegExp(
"^((?<owner>[^:@/]+)/)?(?<repo>[^:@/]+)(@(?<ref>[^:]+))?(:(?<path>.+))?$"
);
@@ -151491,7 +151504,7 @@ function parseRemoteFileAddress(env, configFile) {
);
}
return {
owner: owner || getDefaultOwner(env),
owner: owner || getDefaultOwner(actionState.env),
repo,
path: path29 || DEFAULT_CONFIG_FILE_NAME,
ref: ref || DEFAULT_CONFIG_FILE_REF
@@ -151515,7 +151528,7 @@ function getConfigFileInput(logger, actions, repositoryProperties) {
return void 0;
}
async function getRemoteConfig(actionState, configFile, apiDetails) {
const address = parseRemoteFileAddress(getEnv(), configFile);
const address = await parseRemoteFileAddress(actionState, configFile);
const response = await getApiClientWithExternalAuth(apiDetails).rest.repos.getContent({
owner: address.owner,
repo: address.repo,