From 9078f938dd9b1086d093dabbfe67baf7e22c7a77 Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Wed, 31 May 2023 11:29:13 -0400 Subject: [PATCH 1/3] Add newline after the match token in error comments For some reason, Github's rendering of markdown is disabled on any line that starts with a comment (``). However, markdown rendering resumes on the next line. This is an easy fix which just adds a newline after the match token. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1e5cce9..674c27e 100644 --- a/index.js +++ b/index.js @@ -128,7 +128,7 @@ async function exitWithError(exitType, octokit, shouldAddComment, message) { const params = { ...github.context.repo, issue_number: github.context.issue.number, - body: `${matchToken}${message}`, + body: `${matchToken}\n${message}`, }; // If so, update it From 08fc8f3b4b3b4d8597bb533be99c60efd7c3bbe3 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Mon, 5 Jun 2023 13:06:44 +0100 Subject: [PATCH 2/3] Fix unit tests --- index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.test.js b/index.test.js index 1b22771..c6d0e1e 100644 --- a/index.test.js +++ b/index.test.js @@ -6,7 +6,7 @@ const mockedEnv = require("mocked-env"); const nock = require("nock"); nock.disableNetConnect(); -const matchToken = ``; +const matchToken = `\n`; describe("Required Labels", () => { let restore; From 6787830b61388c9e25b53787f252a4d05ab7d800 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Mon, 5 Jun 2023 13:07:47 +0100 Subject: [PATCH 3/3] Move newline character to matchToken constant --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 674c27e..aba5a2f 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ const core = require("@actions/core"); const github = require("@actions/github"); -const matchToken = ``; +const matchToken = `\n`; async function action() { try { const token = core.getInput("token", { required: true }); @@ -128,7 +128,7 @@ async function exitWithError(exitType, octokit, shouldAddComment, message) { const params = { ...github.context.repo, issue_number: github.context.issue.number, - body: `${matchToken}\n${message}`, + body: `${matchToken}${message}`, }; // If so, update it