From 712993113c03f4cc64c0d37406c0bbf34c3febe5 Mon Sep 17 00:00:00 2001 From: Javier Bullrich Date: Mon, 30 Oct 2023 14:57:25 +0100 Subject: [PATCH] improved logs --- src/github/pullRequest.ts | 8 +++++--- src/runner.ts | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/github/pullRequest.ts b/src/github/pullRequest.ts index 2f52471..4cf6197 100644 --- a/src/github/pullRequest.ts +++ b/src/github/pullRequest.ts @@ -115,9 +115,11 @@ export class PullRequestApi { if (users || teams) { const validArray = (array: string[] | undefined): boolean => !!array && array.length > 0; const reviewersLog = [ - validArray(users) ? `Teams: ${JSON.stringify(users)}` : "", - validArray(teams) ? `Users: ${JSON.stringify(teams)}` : "", - ].join(" - "); + validArray(users) ? `Teams: ${JSON.stringify(users)}` : undefined, + validArray(teams) ? `Users: ${JSON.stringify(teams)}` : undefined, + ] + .filter((e) => !!e) + .join(" - "); this.logger.info(`Requesting reviews from ${reviewersLog}`); diff --git a/src/runner.ts b/src/runner.ts index 492b1e2..501e042 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -41,7 +41,7 @@ export class ActionRunner { private readonly polkadotApi: TeamApi, private readonly checks: GitHubChecksApi, private readonly logger: ActionLogger, - ) {} + ) { } /** * Fetches the configuration file, parses it and validates it. @@ -191,6 +191,8 @@ export class ActionRunner { finalReport.usersToRequest = concatArraysUniquely(finalReport.usersToRequest, report.usersToRequest); } + this.logger.debug(`Request data: ${JSON.stringify(finalReport)}`); + let { teamsToRequest, usersToRequest } = finalReport; /**