From 82e5ca6c55fb2fe8ccb303cb2c9a82798b6ed5fa Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 23 Jun 2026 16:48:34 +0100 Subject: [PATCH] Return `RemoteFileAddress` from `parseRemoteFileAddress` --- lib/entry-points.js | 17 +++++++++++------ src/config/file.ts | 10 +++++----- src/config/remote-file.ts | 9 +++++++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 792a8cbd8..40188eb2d 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -151439,7 +151439,12 @@ function parseRemoteFileAddress(configFile) { getConfigFileRepoFormatInvalidMessage(configFile) ); } - return pieces.groups; + return { + owner: pieces.groups.owner, + repo: pieces.groups.repo, + path: pieces.groups.path, + ref: pieces.groups.ref + }; } // src/config/file.ts @@ -151459,12 +151464,12 @@ function getConfigFileInput(logger, actions, repositoryProperties) { return void 0; } async function getRemoteConfig(logger, configFile, apiDetails, validateConfig) { - const groups = parseRemoteFileAddress(configFile); + const address = parseRemoteFileAddress(configFile); const response = await getApiClientWithExternalAuth(apiDetails).rest.repos.getContent({ - owner: groups.owner, - repo: groups.repo, - path: groups.path, - ref: groups.ref + owner: address.owner, + repo: address.repo, + path: address.path, + ref: address.ref }); let fileContents; if ("content" in response.data && response.data.content !== void 0) { diff --git a/src/config/file.ts b/src/config/file.ts index b48a27c5c..693a35306 100644 --- a/src/config/file.ts +++ b/src/config/file.ts @@ -45,15 +45,15 @@ export async function getRemoteConfig( apiDetails: api.GitHubApiCombinedDetails, validateConfig: boolean, ): Promise { - const groups = parseRemoteFileAddress(configFile); + const address = parseRemoteFileAddress(configFile); const response = await api .getApiClientWithExternalAuth(apiDetails) .rest.repos.getContent({ - owner: groups.owner, - repo: groups.repo, - path: groups.path, - ref: groups.ref, + owner: address.owner, + repo: address.repo, + path: address.path, + ref: address.ref, }); let fileContents: string; diff --git a/src/config/remote-file.ts b/src/config/remote-file.ts index a50e197eb..66328586f 100644 --- a/src/config/remote-file.ts +++ b/src/config/remote-file.ts @@ -20,7 +20,7 @@ export interface RemoteFileAddress { * @returns The successful result of executing the regex. * @throws `ConfigurationError` if the format of `configFile` is not valid. */ -export function parseRemoteFileAddress(configFile: string) { +export function parseRemoteFileAddress(configFile: string): RemoteFileAddress { // retrieve the various parts of the config location, and ensure they're present const format = new RegExp( "(?[^/]+)/(?[^/]+)/(?[^@]+)@(?.*)", @@ -34,5 +34,10 @@ export function parseRemoteFileAddress(configFile: string) { ); } - return pieces.groups; + return { + owner: pieces.groups.owner, + repo: pieces.groups.repo, + path: pieces.groups.path, + ref: pieces.groups.ref, + }; }