Skip to content

Commit a3f14af

Browse files
committed
refactor: conditionally handle pushed_at and updated_at fields for pre-generated data
1 parent 281f394 commit a3f14af

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.github/actions/fetch-repositories/fetch-catalogue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class CatalogueFetcher {
5454
forks_count: repo.forks_count,
5555
watchers_count: repo.watchers_count,
5656
subscribers_count: repo.subscribers_count,
57+
// when it's pregenerated we cannot store these fields because they change too often
5758
// pushed_at: repo.pushed_at,
5859
// updated_at: repo.updated_at,
5960
license: license,

src/app/services/catalogue/catalogue.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ export class CatalogueService {
324324
safe.stargazers_count = typeof safe.stargazers_count === 'number' ? safe.stargazers_count : 0;
325325
safe.forks_count = typeof safe.forks_count === 'number' ? safe.forks_count : 0;
326326
safe.created_at = safe.created_at || new Date().toISOString();
327-
safe.pushed_at = safe.pushed_at || safe.updated_at || new Date().toISOString();
327+
// when it's pregenerated we cannot show these fields because they are not always up-to-date
328+
if (!this.isUsingPreGeneratedFile()) {
329+
safe.pushed_at = safe.pushed_at || safe.updated_at || new Date().toISOString();
330+
}
328331
safe.default_branch = safe.default_branch || 'master';
329332
return safe as Repository;
330333
}

0 commit comments

Comments
 (0)