Skip to content
Snippets Groups Projects
Unverified Commit aaa8b71d authored by Sergei Zharinov's avatar Sergei Zharinov Committed by GitHub
Browse files

fix(github): Fix determine old cache format detection (#17989)

parent 7cd64083
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,12 @@ function isOldCache(prCache: unknown): prCache is ApiPageCache<GhRestPr> {
!is.emptyObject(prCache.items)
) {
const [item] = Object.values(prCache.items);
if (is.plainObject(item) && is.string(item.node_id)) {
// istanbul ignore if
if (
is.plainObject(item) &&
is.plainObject(item.head) &&
is.plainObject(item.base)
) {
return true;
}
}
......@@ -26,6 +31,7 @@ function isOldCache(prCache: unknown): prCache is ApiPageCache<GhRestPr> {
function migrateCache(cache: unknown): void {
const items: ApiPageCache<GhPr>['items'] = {};
// istanbul ignore if
if (isOldCache(cache)) {
for (const item of Object.values(cache.items)) {
items[item.number] = coerceRestPr(item);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment