From 0693dd14d656a87ae8b885e7e2eeb1fdd3a58f49 Mon Sep 17 00:00:00 2001 From: Ross Reicks Date: Thu, 11 Jul 2024 14:33:43 -0500 Subject: [PATCH] feat: post pr comment --- src/main.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.ts b/src/main.ts index 45fd95d..8fd2bab 100644 --- a/src/main.ts +++ b/src/main.ts @@ -219,6 +219,20 @@ class TestReporter { core.info(`Check run HTML: ${resp.data.html_url}`) core.setOutput('url', resp.data.url) core.setOutput('url_html', resp.data.html_url) + + const {pull_request} = github.context.payload + + if (pull_request) { + core.info('Attaching Test Summary as a comment to the PR') + + const comment = `## Test Summary\n\n${summary}` + + await this.octokit.rest.issues.createComment({ + ...github.context.repo, + issue_number: pull_request.number, + body: comment + }) + } } return results