Skip to content

Commit

Permalink
change string | null to ?
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcnellis committed Sep 27, 2024
1 parent fa2f8a7 commit dc5937f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/apphosting/githubConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ const MANAGE_INSTALLATION_CHOICE = "@MANAGE_INSTALLATION";
export async function getOrCreateGithubConnection(
projectId: string,
location: string,
connectionId: string | null,
createConnectionId?: string,
): Promise<devConnect.Connection> {
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.
Expand Down Expand Up @@ -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,
);
Expand All @@ -164,7 +164,7 @@ export async function getOrCreateGithubConnection(
export async function linkGitHubRepository(
projectId: string,
location: string,
createConnectionId: string | null,
createConnectionId?: string,
): Promise<devConnect.GitRepositoryLink> {
const connection = await getOrCreateGithubConnection(projectId, location, createConnectionId);

Expand Down
2 changes: 1 addition & 1 deletion src/apphosting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export async function doSetup(
export async function createGitRepoLink(
projectId: string,
location: string | null,
connectionId: string | null,
connectionId?: string,
): Promise<void> {
await Promise.all([
ensure(projectId, developerConnectOrigin(), "apphosting", true),
Expand Down

0 comments on commit dc5937f

Please sign in to comment.