Commit a2bf459

Anton Medvedev <anton@medv.io>
2023-10-04 18:25:20
Rearrange abc order
1 parent e1bb9ee
Changed files (1)
src
all-badges
abc-commit
src/all-badges/abc-commit/abc-commit.ts
@@ -20,18 +20,26 @@ export default new class implements BadgePresenter {
       ['ab', 'ab-commit'],
       ['a', 'a-commit'],
     ]
+    const order: (Function | undefined)[] = Array.from(Array(10))
+
     for (const repo of data.repos) {
       for (const commit of repo.commits) {
         for (const [prefix, badge] of types) {
           const re = new RegExp(`^(${prefix})`)
           if (re.test(commit.sha)) {
-            grant(badge, `One of my commit sha starts with "${prefix}".`)
+            order[prefix.length] = () => grant(badge, `One of my commit sha starts with "${prefix}".`)
               .evidence(link(re, repo, commit))
             break
           }
         }
       }
     }
+
+    for (const fn of order) {
+      if (fn) {
+        fn()
+      }
+    }
   }
 }