Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Bao Zhiyuan committed Oct 29, 2024
1 parent 3704306 commit bf1b6b1
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/build.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fs from 'node:fs'
import cp from 'node:child_process'
import querystring from 'node:querystring'
import markdownit from 'markdown-it'
import * as octokit from 'octokit'
Expand Down Expand Up @@ -51,17 +50,39 @@ type MetaInfo = {

const metaInfos = new Map<string, MetaInfo>()

async function collectMetaInfos(): Promise<void> {
const pulls = await ghClient.request('GET /repos/{owner}/{repo}/pulls', {
async function getPulls() {
return await ghClient.request('GET /repos/{owner}/{repo}/pulls', {
state: 'closed',
owner: 'moonbitlang',
repo: 'MoonBit-Code-JAM-2024',
per_page: 100,
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
})
}

async function allPrs() {
const pulls: Awaited<ReturnType<typeof getPulls>>['data'] = []
let pagesRemaining = true
while (pagesRemaining) {
const res = await ghClient.request('GET /repos/{owner}/{repo}/pulls', {
state: 'closed',
owner: 'moonbitlang',
repo: 'MoonBit-Code-JAM-2024',
per_page: 100,
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
})
pulls.push(...res.data)
}
return pulls
}

for (const pull of pulls.data) {
async function collectMetaInfos(): Promise<void> {
const pulls = await allPrs()
for (const pull of pulls) {
const pull_number = pull.number
const files = await ghClient.request(
'GET /repos/{owner}/{repo}/pulls/{pull_number}/files',
Expand Down

0 comments on commit bf1b6b1

Please sign in to comment.