Skip to content

Commit f35a365

Browse files
authored
Fix bug where fetching linkable repos for a connection uses location associated with the backend instead of the resource itself. (#6612)
The existing implementation includes a bug where it will only look for connection in the region of the backend.
1 parent 916fc34 commit f35a365

File tree

1 file changed

+3
-4
lines changed
  • src/init/features/apphosting

1 file changed

+3
-4
lines changed

src/init/features/apphosting/repo.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ export async function linkGitHubRepository(
103103
existingConns.push(refreshedConn);
104104
}
105105

106-
let { remoteUri, connection } = await promptRepositoryUri(projectId, location, existingConns);
106+
let { remoteUri, connection } = await promptRepositoryUri(projectId, existingConns);
107107
while (remoteUri === "") {
108108
await utils.openInBrowser("https://github.com/apps/google-cloud-build/installations/new");
109109
await promptOnce({
110110
type: "input",
111111
message:
112112
"Press ENTER once you have finished configuring your installation's access settings.",
113113
});
114-
const selection = await promptRepositoryUri(projectId, location, existingConns);
114+
const selection = await promptRepositoryUri(projectId, existingConns);
115115
remoteUri = selection.remoteUri;
116116
connection = selection.connection;
117117
}
@@ -130,12 +130,11 @@ export async function linkGitHubRepository(
130130

131131
async function promptRepositoryUri(
132132
projectId: string,
133-
location: string,
134133
connections: gcb.Connection[]
135134
): Promise<{ remoteUri: string; connection: gcb.Connection }> {
136135
const remoteUriToConnection: Record<string, gcb.Connection> = {};
137136
for (const conn of connections) {
138-
const { id } = parseConnectionName(conn.name)!;
137+
const { location, id } = parseConnectionName(conn.name)!;
139138
const resp = await gcb.fetchLinkableRepositories(projectId, location, id);
140139
if (resp.repositories && resp.repositories.length > 0) {
141140
for (const repo of resp.repositories) {

0 commit comments

Comments
 (0)