Make path optional in parseRemoteFileAddress

This commit is contained in:
Michael B. Gale
2026-06-23 17:32:44 +01:00
parent 598d00854a
commit e537ff20a4
3 changed files with 28 additions and 11 deletions

7
lib/entry-points.js generated
View File

@@ -151429,13 +151429,14 @@ function parseUserConfig(logger, pathInput, contents, validateConfig) {
}
// src/config/remote-file.ts
var DEFAULT_CONFIG_FILE_NAME = ".github/codeql-action.yaml";
var DEFAULT_CONFIG_FILE_REF = "main";
function parseRemoteFileAddress(configFile) {
const format = new RegExp(
"(?<owner>[^/]+)/(?<repo>[^/]+)/(?<path>[^@]+)(@(?<ref>.*))?"
"(?<owner>[^/]+)/(?<repo>[^/@]+)(/(?<path>[^@]+))?(@(?<ref>.*))?"
);
const pieces = format.exec(configFile);
if (!pieces?.groups?.owner || !pieces?.groups?.repo || !pieces?.groups?.path) {
if (!pieces?.groups?.owner || !pieces?.groups?.repo) {
throw new ConfigurationError(
getConfigFileRepoFormatInvalidMessage(configFile)
);
@@ -151443,7 +151444,7 @@ function parseRemoteFileAddress(configFile) {
return {
owner: pieces.groups.owner,
repo: pieces.groups.repo,
path: pieces.groups.path,
path: pieces.groups.path || DEFAULT_CONFIG_FILE_NAME,
ref: pieces.groups.ref || DEFAULT_CONFIG_FILE_REF
};
}