Commit b7b1679

Anton Medvedev <anton@medv.io>
2023-10-06 23:13:21
Add star-gazer
1 parent aef0c92
src/all-badges/star-gazer/star-gazer.png
Binary file
src/all-badges/star-gazer/star-gazer.ts
@@ -0,0 +1,14 @@
+import {BadgePresenter, Present} from '../../badges.js'
+
+export default new class implements BadgePresenter {
+  url = new URL(import.meta.url)
+  badges = [
+    'star-gazer',
+  ] as const
+  present: Present = (data, grant) => {
+    if (data.user.starredRepositories.totalCount >= 1000) {
+      grant('star-gazer', 'I\'m a star gazer!')
+        .evidence('I\'ve starred over 1000 repositories!')
+    }
+  }
+}
src/all-badges/index.ts
@@ -1,10 +1,11 @@
 export const allBadges = [
   await import('./abc-commit/abc-commit.js'),
   await import('./stars/stars.js'),
+  await import('./time-of-commit/time-of-commit.js'),
+  await import('./yeti/yeti.js'),
+  await import('./star-gazer/star-gazer.js'),
   await import('./dead-commit/dead-commit.js'),
   await import('./fuck-commit/fuck-commit.js'),
   await import('./mass-delete-commit/mass-delete-commit.js'),
   await import('./revert-revert-commit/revert-revert-commit.js'),
-  await import('./yeti/yeti.js'),
-  await import('./time-of-commit/time-of-commit.js'),
 ] as const
src/collect/user.graphql
@@ -42,6 +42,9 @@ query UserQuery(
     sponsors {
       totalCount
     }
+    starredRepositories {
+      totalCount
+    }
   }
   rateLimit {
     limit
src/collect/user.ts
@@ -35,6 +35,9 @@ export type UserQuery = {
     sponsors: {
       totalCount: number
     }
+    starredRepositories: {
+      totalCount: number
+    }
   }
   rateLimit: {
     limit: number
README.md
@@ -153,7 +153,6 @@ Feel free to grab any of these ideas and implement them:
 - **pr-champion** - For those who have a high number of pull requests merged.
 - **community-builder** - For users with a high number of followers or those who contribute to popular community-driven projects.
 - **fork-fanatic** - For those who have forked a large number of repositories.
-- **star-gazer** - Users who have starred a vast number of repositories.
 - **watcher** - For users who watch a high number of repositories, staying updated with many projects.
 - **social-butterfly** - For those with a high number of interactions (comments, reactions) across GitHub.