Skip to content

Commit ba7865f

Browse files
authored
More logs in PR model (#6648)
Part of #6513
1 parent a1ad550 commit ba7865f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/github/pullRequestModel.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,14 +1412,13 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
14121412
* List the changed files in a pull request.
14131413
*/
14141414
private async getRawFileChangesInfo(): Promise<IRawFileChange[]> {
1415-
Logger.debug(
1416-
`Fetch file changes, base, head and merge base of PR #${this.number} - enter`,
1417-
PullRequestModel.ID,
1418-
);
1415+
Logger.debug(`Fetch file changes, base, head and merge base of PR #${this.number} - enter`, PullRequestModel.ID);
1416+
14191417
const githubRepository = this.githubRepository;
14201418
const { octokit, remote } = await githubRepository.ensure();
14211419

14221420
if (!this.base) {
1421+
Logger.appendLine('No base branch found for PR, fetching it now', PullRequestModel.ID);
14231422
const info = await octokit.call(octokit.api.pulls.get, {
14241423
owner: remote.owner,
14251424
repo: remote.repositoryName,
@@ -1438,6 +1437,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
14381437
}
14391438

14401439
if (this.item.merged) {
1440+
Logger.appendLine('PR is merged, fetching all file changes', PullRequestModel.ID);
14411441
const response = await restPaginate<typeof octokit.api.pulls.listFiles, IRawFileChange>(octokit.api.pulls.listFiles, {
14421442
repo: remote.repositoryName,
14431443
owner: remote.owner,
@@ -1450,6 +1450,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
14501450
return response;
14511451
}
14521452

1453+
Logger.debug(`Comparing commits for ${remote.owner}/${remote.repositoryName} with base ${this.base.repositoryCloneUrl.owner}:${compareWithBaseRef} and head ${this.head!.repositoryCloneUrl.owner}:${this.head!.sha}`, PullRequestModel.ID);
14531454
const { data } = await octokit.call(octokit.api.repos.compareCommits, {
14541455
repo: remote.repositoryName,
14551456
owner: remote.owner,
@@ -1465,10 +1466,8 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
14651466
if (data.files && data.files.length >= MAX_FILE_CHANGES_IN_COMPARE_COMMITS) {
14661467
// compareCommits will return a maximum of 100 changed files
14671468
// If we have (maybe) more than that, we'll need to fetch them with listFiles API call
1468-
Logger.debug(
1469-
`More than ${MAX_FILE_CHANGES_IN_COMPARE_COMMITS} files changed, fetching all file changes of PR #${this.number}`,
1470-
PullRequestModel.ID,
1471-
);
1469+
Logger.appendLine(
1470+
`More than ${MAX_FILE_CHANGES_IN_COMPARE_COMMITS} files changed in #${this.number}`, PullRequestModel.ID);
14721471
files = await restPaginate<typeof octokit.api.pulls.listFiles, IRawFileChange>(octokit.api.pulls.listFiles, {
14731472
owner: this.base.repositoryCloneUrl.owner,
14741473
pull_number: this.number,

0 commit comments

Comments
 (0)