mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Gate new remote file format behind FF
This commit is contained in:
19
lib/entry-points.js
generated
19
lib/entry-points.js
generated
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user