Skip to content

Commit

Permalink
Added more debug log verbosity (#76)
Browse files Browse the repository at this point in the history
Added more logs when fetching approvals and team members.

Removed a left over log

Now the debug logs will count the author and will show the team members
(debug logs can only be seen by people who have access to trigger the
actions)

Resolves #74

Updated version to `1.0.1`
  • Loading branch information
Bullrich authored Sep 8, 2023
1 parent feb3619 commit 697f995
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ outputs:

runs:
using: 'docker'
image: 'docker://ghcr.io/paritytech/review-bot/action:1.0.0'
image: 'docker://ghcr.io/paritytech/review-bot/action:1.0.1'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "review-bot",
"version": "1.0.0",
"version": "1.0.1",
"description": "Have custom review rules for PRs with auto assignment",
"main": "src/index.ts",
"scripts": {
Expand Down
10 changes: 6 additions & 4 deletions src/github/pullRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ export class PullRequestApi {
const approvals = latestReviews.filter((review) => caseInsensitiveEqual(review.state, "approved"));
this.usersThatApprovedThePr = approvals.map((approval) => approval.user.login);
}
this.logger.debug(`PR approvals are ${JSON.stringify(this.usersThatApprovedThePr)}`);

const approvals = this.usersThatApprovedThePr;

if (countAuthor) {
// If this value is true, we add the author to the list of approvals
return [...this.usersThatApprovedThePr, this.pr.user.login];
this.logger.info("Counting author in list of approvals");
approvals.push(this.pr.user.login);
}
this.logger.debug(`PR approvals are ${JSON.stringify(approvals)}`);

return this.usersThatApprovedThePr;
return approvals;
}

/** Returns the login of the PR's author */
Expand Down
1 change: 1 addition & 0 deletions src/github/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class GitHubTeamsApi implements TeamApi {
this.logger.debug(`Fetching team '${teamName}'`);
const { data } = await this.api.rest.teams.listMembersInOrg({ org: this.org, team_slug: teamName });
const members = data.map((d) => d.login);
this.logger.debug(`Members are ${JSON.stringify(members)}`);
this.teamsCache.set(teamName, members);
}
return this.teamsCache.get(teamName) as string[];
Expand Down

0 comments on commit 697f995

Please sign in to comment.