Skip to content

Commit

Permalink
chore: log with repository context
Browse files Browse the repository at this point in the history
Allows to track down merge errors more easily.
  • Loading branch information
nikku committed Jul 23, 2021
1 parent 795a14c commit 222e86c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,7 @@ async function checkMerge(context, pullRequest) {
} else if (isMergeCheckError(error)) {
context.log.debug(ctx, `skipping: ${error.message}`);
} else {
context.log.error(ctx, 'skipping: merge check error');
context.log.error(error);
throw error;
}

return false;
Expand Down Expand Up @@ -932,6 +931,10 @@ function getEffectiveReviewTeams(teams, reviewers, requestedTeams) {
*/
async function getTeamsWithMembers(context, pullRequest, reviewTeams) {

const ctx = context.repo({
pull_number: pullRequest.number
});

const org = getPullRequestTargetOrg(pullRequest);

const teamMembers = await Promise.all(reviewTeams.map(async (teamSlug) => {
Expand All @@ -943,6 +946,8 @@ async function getTeamsWithMembers(context, pullRequest, reviewTeams) {
team_slug: teamSlug
}).catch(error => {

context.log.debug(ctx, `failed to fetch team ${teamSlug}`, error);

// app is missing missing permissions
if (error.status === 403) {
throw MergeCheckError(`failed to fetch team ${org}/${teamSlug} (status=403)`);
Expand Down

0 comments on commit 222e86c

Please sign in to comment.