Skip to content

Commit

Permalink
change octokit request to getall commits at once
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiagoJavierRubio committed Nov 30, 2023
1 parent 1399b01 commit 2e6e8c8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions apps/server/src/commits/commits.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ export class CommitsService {
constructor(private readonly octokit: OctokitClient, private readonly configService: ConfigService) {}

async getAllCommits() {
const response = await this.octokit.getClient().request('GET /repos/{owner}/{repo}/commits', {
const response = await this.octokit.getClient().paginate('GET /repos/{owner}/{repo}/commits', {
owner: this.configService.get<string>('repo.owner'),
repo: this.configService.get<string>('repo.name')
})
if (response.status !== 200) throw new HttpException('Github client error', response.status)
const parsed = commitList.safeParse(response.data)
}).catch(err => { throw new InternalServerErrorException(err) })
const parsed = commitList.safeParse(response)
if (parsed.success) return parsed.data
else throw new InternalServerErrorException('Github response did not match parameters')
}
Expand Down

0 comments on commit 2e6e8c8

Please sign in to comment.