Commit 29d73ef

Andrew J.Swan <ajs.blackhole@gmail.com>
2025-02-19 11:08:33
On Friday The 13th, They Began To Die Horribly, One… By One… (#118)
1 parent 234cbd7
Changed files (3)
badges/friday-13/friday-13.png
Binary file
badges/friday-13/friday-13.ts
@@ -0,0 +1,25 @@
+import { Commit, define, latest } from '#src'
+
+export default define({
+  url: import.meta.url,
+  badges: ['friday-13'] as const,
+  present(data, grant) {
+    const commits: Commit[] = []
+
+    for (const repo of data.repos) {
+      for (const commit of repo.commits) {
+        const data = new Date(commit.committedDate)
+        if (data.getDay() === 5 && data.getDate() === 13) {
+          commits.push(commit)
+        }
+      }
+    }
+
+    if (commits.length > 0) {
+      grant(
+        'friday-13',
+        'I committed on Friday the 13th, One… By One…',
+      ).evidenceCommits(...commits.sort(latest).slice(0, 13))
+    }
+  },
+})
badges/index.ts
@@ -11,6 +11,7 @@ export default [
   await import('./epic-commit/epic-commit.js'),
   await import('./favorite-word/favorite-word.js'),
   await import('./fix-commit/fix-commit.js'),
+  await import('./friday-13/friday-13.js'),
   await import('./github-anniversary/github-anniversary.js'),
   await import('./leap-day/leap-day.js'),
   await import('./mass-delete-commit/mass-delete-commit.js'),