diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b1f1db..e1cb3d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v2.5.3 +- [Fixed retrieval of all changes via Github API when there are 100+ changes](https://github.com/dorny/paths-filter/pull/50) + ## v2.5.2 - [Add support for multiple patterns when using file status](https://github.com/dorny/paths-filter/pull/48) - [Use picomatch directly instead of micromatch wrapper](https://github.com/dorny/paths-filter/pull/49) diff --git a/README.md b/README.md index bf6c257..554d327 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ For more scenarios see [examples](#examples) section. # What's New +- Fixed retrieval of all changes via Github API when there are 100+ changes - Paths expressions are now evaluated using [picomatch](https://github.com/micromatch/picomatch) library - Support workflows triggered by any event - Fixed compatibility with older (<2.23) versions of git diff --git a/dist/index.js b/dist/index.js index 3364dc3..842497e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4729,12 +4729,15 @@ async function getChangedFilesFromGit(base, initialFetchDepth) { } // Uses github REST api to get list of files changed in PR async function getChangedFilesFromApi(token, pullRequest) { + var _a; core.info(`Fetching list of changed files for PR#${pullRequest.number} from Github API`); const client = new github.GitHub(token); const pageSize = 100; const files = []; - for (let page = 0; page * pageSize < pullRequest.changed_files; page++) { - const response = await client.pulls.listFiles({ + let response; + let page = 0; + do { + response = await client.pulls.listFiles({ owner: github.context.repo.owner, repo: github.context.repo.repo, pull_number: pullRequest.number, @@ -4763,7 +4766,8 @@ async function getChangedFilesFromApi(token, pullRequest) { }); } } - } + page++; + } while (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.length) > 0); return files; } function exportResults(results, format) {