diff --git a/src/github/pullRequest.ts b/src/github/pullRequest.ts index 422e7bc..76967b2 100644 --- a/src/github/pullRequest.ts +++ b/src/github/pullRequest.ts @@ -7,16 +7,20 @@ export class PullRequestApi { private readonly repo: { owner: string; repo: string }, ) {} - async listPRs(onlyAutoMerge: boolean): Promise { + async listPRs( + onlyAutoMerge: boolean, + ): Promise<{ number: number; title: string }[]> { const openPRs = await this.api.paginate(this.api.rest.pulls.list, { ...this.repo, state: "open", }); if (onlyAutoMerge) { - return openPRs.filter((pr) => pr.auto_merge).map((pr) => pr.number); + return openPRs + .filter((pr) => pr.auto_merge) + .map(({ number, title }) => ({ number, title }) as const); } else { - return openPRs.map((pr) => pr.number); + return openPRs.map(({ number, title }) => ({ number, title }) as const); } } diff --git a/src/index.ts b/src/index.ts index d37546c..1fe67e0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,19 +35,20 @@ const action = async () => { const rows: SummaryTableRow[] = [ [ { data: "PR Number", header: true }, + { data: "Title", header: true }, { data: "Result", header: true }, ], ]; - for (const number of prs) { - logger.info(`📡 - Updating #${number}`); + for (const { number, title } of prs) { + logger.info(`📡 - Updating ${title} #${number}`); const repoTxt = `[#${number}](https://github.com/${repoInfo.owner}/${repoInfo.repo}/pull/${number})`; try { await api.update(number); - rows.push([repoTxt, "Pass ✅"]); + rows.push([repoTxt, title, "Pass ✅"]); logger.info(`📥 - Updated #${number}`); } catch (error) { logger.error(error as string | Error); - rows.push([repoTxt, "Fail ❌"]); + rows.push([repoTxt, title, "Fail ❌"]); } } logger.info(" - Finished updating PRs");