Skip to content

Commit

Permalink
refactor(get-app-authentication): allow undefined as value for timeDi…
Browse files Browse the repository at this point in the history
…fference parameter
  • Loading branch information
oscard0m committed Sep 24, 2024
1 parent fd67b16 commit b6682cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/get-app-authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function getAppAuthentication({
privateKey,
timeDifference,
}: State & {
timeDifference?: number;
timeDifference?: number | undefined;
}): Promise<AppAuthentication> {
try {
const appAuthentication = timeDifference
Expand Down
14 changes: 4 additions & 10 deletions src/get-installation-authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export async function getInstallationAuthentication(
state.cache,
optionsWithInstallationTokenFromState,
);

if (result) {
const {
token,
Expand All @@ -52,7 +53,7 @@ export async function getInstallationAuthentication(
repositorySelection,
} = result;

const authParams = {
return toTokenAuthentication({
installationId,
token,
createdAt,
Expand All @@ -61,15 +62,8 @@ export async function getInstallationAuthentication(
repositorySelection,
repositoryIds,
repositoryNames,
};

if (singleFileName) {
Object.assign(authParams, {
singleFileName,
});
}

return toTokenAuthentication(authParams);
singleFileName,
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b6682cc

Please sign in to comment.