Merge pull request #2643 from Luis-Fernando-Molina/develop
Contribution: Governance Bug Fix: File Changed List not considering pagination
This commit is contained in:
1 file changed
+23
-7
@@ -284,13 +284,29 @@ exports.newGithubServer = function newGithubServer() {
|
||||
/*
|
||||
Lets get the files changed at this Pull Request.
|
||||
*/
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
let listResponse = await octokit.rest.pulls.listFiles({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
pull_number: pullRequest.number
|
||||
});
|
||||
let filesChanged = listResponse.data
|
||||
let filesChanged = []
|
||||
const per_page = 100 // Max
|
||||
let page = 0
|
||||
let lastPage = false
|
||||
|
||||
while (lastPage === false) {
|
||||
await PL.projects.foundations.utilities.asyncFunctions.sleep(GITHUB_API_WAITING_TIME)
|
||||
let listResponse = await octokit.rest.pulls.listFiles({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
pull_number: pullRequest.number,
|
||||
per_page: per_page,
|
||||
page: page
|
||||
});
|
||||
|
||||
if (listResponse.data.length < 100) {
|
||||
lastPage = true
|
||||
}
|
||||
for (let i = 0; i < listResponse.data.length; i++) {
|
||||
let listItem = listResponse.data[i]
|
||||
filesChanged.push(listItem)
|
||||
}
|
||||
}
|
||||
let fileContentUrl // URL to the only file at the PR
|
||||
let fileContent // File content of the only file at the PR
|
||||
let userProfile // User Profile Object
|
||||
|
||||
Reference in new issue
Block a user