Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/init/features/apphosting/repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ 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({
type: "input",
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;
}
Expand All @@ -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<string, gcb.Connection> = {};
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) {
Expand Down