Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions docs/donations/projects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,11 @@ These are the [CNCF](https://www.cncf.io/) and [OpenSSF](https://openssf.org/) p
description="Simple backup utility for GNOME"
sponsorUrl="https://liberapay.com/DejaDup"
icon="https://github.com/deja-dup.png"
githubRepo="deja-dup/deja-dup"
/>
<ProjectCard
name="Mission Center"
description="Monitor your CPU, Memory, Disk, Network and GPU usage"
icon="https://github.com/Flavius42.png"
githubRepo="Flavius42/mission-center"
icon="https://github.com/mission-center-devs.png"
/>
<ProjectCard
name="Impression"
Expand All @@ -251,8 +249,8 @@ These are the [CNCF](https://www.cncf.io/) and [OpenSSF](https://openssf.org/) p
<ProjectCard
name="Refine"
description="GNOME tweaking tool"
icon="https://github.com/tesk-g.png"
githubRepo="tesk-g/refine"
icon="https://github.com/TheEvilSkeleton.png"
githubRepo="TheEvilSkeleton/Refine"
/>
<ProjectCard
name="Smile"
Expand Down
48 changes: 43 additions & 5 deletions scripts/fetch-github-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ const GITHUB_REPOS = [
"flattool/ignition",
"tchx84/Flatseal",
"mjakeman/extension-manager",
"deja-dup/deja-dup",
"Flavius42/mission-center",
// deja-dup/deja-dup and Flavius42/mission-center have no canonical GitHub
// repo: both projects moved development to GNOME GitLab and no longer
// publish an equivalent GitHub repository, so they are intentionally
// omitted here (see docs/donations/projects.mdx).
"adhami3310/impression",
"PintaProject/Pinta",
"GNOME/Showtime",
"tesk-g/refine",
"TheEvilSkeleton/Refine", // formerly tesk-g/refine; account renamed
"mijorus/smile",

// Homebrew CLI Tools (bluefin-cli)
Expand Down Expand Up @@ -148,11 +150,47 @@ async function fetchAllRepos() {
},
);

const repos = Object.fromEntries(resultsMap);
// Load whatever cache already exists on disk so a failed fetch for one
// repo (rate limiting, transient network error, etc.) doesn't erase stats
// that were previously fetched successfully for that same repo.
let existingCache = {};
if (fs.existsSync(OUTPUT_FILE)) {
try {
existingCache = JSON.parse(fs.readFileSync(OUTPUT_FILE, "utf-8"));
} catch (error) {
console.warn(`⚠️ Could not parse existing cache: ${error.message}`);
}
}

// ponytail: cache is parsed with JSON.parse and trusted as-is; entries are
// assumed to be {full_name, stargazers_count, forks_count}. Add a shape
// guard if untrusted/external caches can ever land in github-repos.json.

const freshRepos = Object.fromEntries(resultsMap);

// Merge: start from cached entries for repos still tracked (dropping any
// that were removed from GITHUB_REPOS), then overlay this run's successes.
// A repo that failed this run keeps its last-known-good stats instead of
// disappearing entirely.
const repos = {};
for (const repoPath of GITHUB_REPOS) {
if (existingCache[repoPath]) {
repos[repoPath] = existingCache[repoPath];
}
}
Object.assign(repos, freshRepos);

const failedCount = GITHUB_REPOS.length - Object.keys(freshRepos).length;
console.log(
`\nSuccessfully fetched ${Object.keys(repos).length}/${GITHUB_REPOS.length} repos`,
`\nSuccessfully fetched ${Object.keys(freshRepos).length}/${GITHUB_REPOS.length} repos`,
);
if (failedCount > 0) {
const recoveredFromCache =
Object.keys(repos).length - Object.keys(freshRepos).length;
console.log(
` ${recoveredFromCache} of the ${failedCount} failures were preserved from the existing cache.`,
);
}

// Don't fail build if no repos fetched - the component will just not show stats
if (Object.keys(repos).length === 0) {
Expand Down
Loading