diff --git a/src/get-app-authentication.ts b/src/get-app-authentication.ts index 519ae318..f5e15945 100644 --- a/src/get-app-authentication.ts +++ b/src/get-app-authentication.ts @@ -7,7 +7,7 @@ export async function getAppAuthentication({ privateKey, timeDifference, }: State & { - timeDifference?: number; + timeDifference?: number | undefined; }): Promise { try { const appAuthentication = timeDifference diff --git a/src/get-installation-authentication.ts b/src/get-installation-authentication.ts index 686bcdda..9a471fa0 100644 --- a/src/get-installation-authentication.ts +++ b/src/get-installation-authentication.ts @@ -40,6 +40,7 @@ export async function getInstallationAuthentication( state.cache, optionsWithInstallationTokenFromState, ); + if (result) { const { token, @@ -52,7 +53,7 @@ export async function getInstallationAuthentication( repositorySelection, } = result; - const authParams = { + return toTokenAuthentication({ installationId, token, createdAt, @@ -61,15 +62,8 @@ export async function getInstallationAuthentication( repositorySelection, repositoryIds, repositoryNames, - }; - - if (singleFileName) { - Object.assign(authParams, { - singleFileName, - }); - } - - return toTokenAuthentication(authParams); + singleFileName, + }); } } diff --git a/src/types.ts b/src/types.ts index 67d54d13..830804ae 100644 --- a/src/types.ts +++ b/src/types.ts @@ -164,7 +164,7 @@ export type InstallationAccessTokenData = { repositorySelection: REPOSITORY_SELECTION; repositoryIds: number[] | undefined; repositoryNames: string[] | undefined; - singleFileName?: string; + singleFileName?: string | undefined; }; export type CacheData = InstallationAccessTokenData;