From 74e9bf2194328e2f707786df4d94bccaa3069977 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 13 Dec 2023 08:32:17 -0800 Subject: [PATCH] Fix bug where fetching linkable repos for a connection uses location associated with the backend instead of the resource itself. --- src/init/features/apphosting/repo.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/init/features/apphosting/repo.ts b/src/init/features/apphosting/repo.ts index 1dd6613435d..e822a05a82c 100644 --- a/src/init/features/apphosting/repo.ts +++ b/src/init/features/apphosting/repo.ts @@ -103,7 +103,7 @@ export async function linkGitHubRepository( existingConns.push(refreshedConn); } - let { remoteUri, connection } = await promptRepositoryUri(projectId, location, existingConns); + let { remoteUri, connection } = await promptRepositoryUri(projectId, existingConns); while (remoteUri === "") { await utils.openInBrowser("https://github.com/apps/google-cloud-build/installations/new"); await promptOnce({ @@ -111,7 +111,7 @@ export async function linkGitHubRepository( message: "Press ENTER once you have finished configuring your installation's access settings.", }); - const selection = await promptRepositoryUri(projectId, location, existingConns); + const selection = await promptRepositoryUri(projectId, existingConns); remoteUri = selection.remoteUri; connection = selection.connection; } @@ -130,12 +130,11 @@ export async function linkGitHubRepository( async function promptRepositoryUri( projectId: string, - location: string, connections: gcb.Connection[] ): Promise<{ remoteUri: string; connection: gcb.Connection }> { const remoteUriToConnection: Record = {}; for (const conn of connections) { - const { id } = parseConnectionName(conn.name)!; + const { location, id } = parseConnectionName(conn.name)!; const resp = await gcb.fetchLinkableRepositories(projectId, location, id); if (resp.repositories && resp.repositories.length > 0) { for (const repo of resp.repositories) {