Commit a488a6e

Anton Medvedev <anton@medv.io>
2023-10-16 12:25:10
Add token to https
1 parent 00e429b
Changed files (2)
src/main.ts
@@ -57,7 +57,7 @@ void (async function main() {
       retry: { doNotRetry: ['429'] },
     })
 
-    if (owner && repo) gitClone(owner, repo)
+    if (owner && repo) gitClone(owner, repo, token)
     const data = await getData(octokit, dataPath, username)
 
     let userBadges = getUserBadges()
src/repo.ts
@@ -3,10 +3,15 @@ import { spawnSync } from 'node:child_process'
 import { chdir } from 'node:process'
 import { Badge } from './badges.js'
 
-export function gitClone(owner: string, repo: string) {
+export function gitClone(owner: string, repo: string, token: string) {
   spawnSync(
     'git',
-    ['clone', '--depth=1', `https://github.com/${owner}/${repo}.git`, 'repo'],
+    [
+      'clone',
+      '--depth=1',
+      `https://${owner}:${token}@github.com/${owner}/${repo}.git`,
+      'repo',
+    ],
     {
       stdio: 'inherit',
     },