From b486bb5ccbbba8e324c60ce0a566ba7ebf701ca2 Mon Sep 17 00:00:00 2001 From: Jonathan Atiene <34762800+bemijonathan@users.noreply.github.com> Date: Sat, 30 Sep 2023 04:52:35 +0100 Subject: [PATCH] loggers --- src/index.ts | 1 + src/steps/post-comment.ts | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/index.ts b/src/index.ts index 842bbaf..40aa32c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,6 +14,7 @@ export async function run(): Promise { const pullRequestNumber = github.context.payload.pull_request?.number Logger.log('pullRequestNumber', pullRequestNumber) + Logger.log('github.context', github.context) // If the PR number is not found, exit the action if (!pullRequestNumber) { diff --git a/src/steps/post-comment.ts b/src/steps/post-comment.ts index 7e3a40a..6ee5b14 100644 --- a/src/steps/post-comment.ts +++ b/src/steps/post-comment.ts @@ -1,14 +1,17 @@ -import * as core from "@actions/core"; -import * as github from "@actions/github"; +import * as core from '@actions/core' +import * as github from '@actions/github' +import { Logger } from 'src/utils.js' export async function postComment(pullRequestNumber: number, summary: string) { - const githubToken = core.getInput("token"); - const octokit = github.getOctokit(githubToken); - const repo = github.context.repo; + const githubToken = core.getInput('token') + const octokit = github.getOctokit(githubToken) + const repo = github.context.repo + Logger.log('posted comment', github.context) - const { data } = await octokit.rest.pulls.update({ - ...repo, - pull_number: pullRequestNumber, - body: summary - }); + const { data } = await octokit.rest.pulls.update({ + ...repo, + pull_number: pullRequestNumber, + body: summary + }) + Logger.log('posted comment', data.body) }