Skip to content

Commit

Permalink
Don't use the token to generate a unique id
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed Oct 7, 2024
1 parent 7b84952 commit c368620
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2725,7 +2725,8 @@ function sha256(message) {
return hash.digest('hex');
}
const getStateInstance = (options) => {
const cacheKey = sha256(JSON.stringify(options));
const json = JSON.stringify(options, (key, value) => key === 'repoToken' ? undefined : value);
const cacheKey = sha256(json);
const storage = new state_cache_storage_1.StateCacheStorage(cacheKey);
return new state_1.State(storage, options);
};
Expand Down
5 changes: 4 additions & 1 deletion src/services/state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function sha256(message: string): string {
}

export const getStateInstance = (options: IIssuesProcessorOptions): IState => {
const cacheKey = sha256(JSON.stringify(options));
const json = JSON.stringify(options, (key, value) =>
key === 'repoToken' ? undefined : value
);
const cacheKey = sha256(json);
const storage = new StateCacheStorage(cacheKey);
return new State(storage, options);
};

0 comments on commit c368620

Please sign in to comment.