Skip to content

Commit

Permalink
feat: Add diamond tier to fetch-sponsors
Browse files Browse the repository at this point in the history
fixes #633
  • Loading branch information
nzakas committed Sep 23, 2024
1 parent 70bd284 commit 95c9f91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/_data/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"monthlyDonations": 9761,
"sponsorCount": 168
},
"diamond": [],
"platinum": [
{
"name": "Automattic",
Expand Down Expand Up @@ -1428,4 +1429,4 @@
"tier": "backer"
}
]
}
}
9 changes: 9 additions & 0 deletions tools/fetch-sponsors.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ function fixUrl(url) {
* @returns {string} The ID of the tier the donation belongs to.
*/
function getTierSlug(monthlyDonation) {
if (monthlyDonation >= 5000) {
return "diamond-sponsor";
}

if (monthlyDonation >= 2000) {
return "platinum-sponsor";
}
Expand Down Expand Up @@ -420,6 +424,7 @@ async function fetchGitHubSponsors() {

// simplified data structure
const tierSponsors = {
diamond: [],
platinum: [],
gold: [],
silver: [],
Expand All @@ -440,6 +445,10 @@ async function fetchGitHubSponsors() {
monthlyDonations += sponsor.monthlyDonation;

switch (sponsor.tier) {
case "diamond-sponsor":
tierSponsors.diamond.push(sponsor);
break;

case "platinum-sponsor":
tierSponsors.platinum.push(sponsor);
break;
Expand Down

0 comments on commit 95c9f91

Please sign in to comment.