mirror of
https://github.com/dorny/paths-filter.git
synced 2024-12-20 00:49:04 +00:00
Merge pull request #50 from simllll/patch-1
fix: retrieve all changes via api
This commit is contained in:
commit
dec8b8030e
10
src/main.ts
10
src/main.ts
@ -2,6 +2,7 @@ import * as fs from 'fs'
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import {Webhooks} from '@octokit/webhooks'
|
||||
import type {Octokit} from '@octokit/rest'
|
||||
|
||||
import {Filter, FilterResults} from './filter'
|
||||
import {File, ChangeStatus} from './file'
|
||||
@ -127,8 +128,10 @@ async function getChangedFilesFromApi(
|
||||
const client = new github.GitHub(token)
|
||||
const pageSize = 100
|
||||
const files: File[] = []
|
||||
for (let page = 0; page * pageSize < pullRequest.changed_files; page++) {
|
||||
const response = await client.pulls.listFiles({
|
||||
let response: Octokit.Response<Octokit.PullsListFilesResponse>
|
||||
let page = 0
|
||||
do {
|
||||
response = await client.pulls.listFiles({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
pull_number: pullRequest.number,
|
||||
@ -156,7 +159,8 @@ async function getChangedFilesFromApi(
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
page++
|
||||
} while (response?.data?.length > 0)
|
||||
|
||||
return files
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user