diff --git a/src/apphosting/githubConnections.ts b/src/apphosting/githubConnections.ts index 70c6becfb4b..ef5070931b2 100644 --- a/src/apphosting/githubConnections.ts +++ b/src/apphosting/githubConnections.ts @@ -95,15 +95,15 @@ const MANAGE_INSTALLATION_CHOICE = "@MANAGE_INSTALLATION"; export async function getOrCreateGithubConnection( projectId: string, location: string, - connectionId: string | null, + createConnectionId?: string, ): Promise { utils.logBullet(clc.bold(`${clc.yellow("===")} Import a GitHub repository`)); - if (connectionId) { + if (createConnectionId) { // Check if the connection already exists. try { - const connection = await devConnect.getConnection(projectId, location, connectionId); - utils.logBullet(`Reusing existing connection ${connectionId}`); + const connection = await devConnect.getConnection(projectId, location, createConnectionId); + utils.logBullet(`Reusing existing connection ${createConnectionId}`); return connection; } catch (e) { // Expected, the connection doesn't exist. @@ -138,19 +138,19 @@ export async function getOrCreateGithubConnection( if (connectionMatchingInstallation) { const { id: matchingConnectionId } = parseConnectionName(connectionMatchingInstallation.name)!; - if (!connectionId || matchingConnectionId === connectionId) { + if (!createConnectionId || matchingConnectionId === createConnectionId) { utils.logBullet(`Reusing matching connection ${matchingConnectionId}`); return connectionMatchingInstallation; } } - if (!connectionId) { - connectionId = generateConnectionId(); + if (!createConnectionId) { + createConnectionId = generateConnectionId(); } const connection = await createFullyInstalledConnection( projectId, location, - connectionId, + createConnectionId, oauthConn, installationId, ); @@ -164,7 +164,7 @@ export async function getOrCreateGithubConnection( export async function linkGitHubRepository( projectId: string, location: string, - createConnectionId: string | null, + createConnectionId?: string, ): Promise { const connection = await getOrCreateGithubConnection(projectId, location, createConnectionId); diff --git a/src/apphosting/index.ts b/src/apphosting/index.ts index 9a041719208..bad3f9d021f 100644 --- a/src/apphosting/index.ts +++ b/src/apphosting/index.ts @@ -192,7 +192,7 @@ export async function doSetup( export async function createGitRepoLink( projectId: string, location: string | null, - connectionId: string | null, + connectionId?: string, ): Promise { await Promise.all([ ensure(projectId, developerConnectOrigin(), "apphosting", true),