From f6651c57283b1f3c6aa2fe3bef3db2c6ec3f53cb Mon Sep 17 00:00:00 2001 From: Sebass van Boxel Date: Fri, 6 Nov 2020 09:38:38 +0100 Subject: [PATCH 1/3] Convert buffer to string --- __tests__/comment.test.ts | 4 ++-- src/main.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/comment.test.ts b/__tests__/comment.test.ts index 52f8acb..c02aca1 100644 --- a/__tests__/comment.test.ts +++ b/__tests__/comment.test.ts @@ -100,7 +100,7 @@ describe("updateComment", () => { it("without comment body and previousbody", async() => { expect( - await updateComment(octokit, repo, 456, "", "") + await updateComment(octokit, repo, 456, "", null) ).toBeUndefined(); expect(octokit.issues.updateComment).not.toBeCalled(); expect(core.warning).toBeCalledWith('Comment body cannot be blank'); @@ -136,7 +136,7 @@ describe("createComment", () => { }) it("without comment body and previousBody", async () => { expect( - await createComment(octokit, repo, 456, "", "") + await createComment(octokit, repo, 456, "", null) ).toBeUndefined(); expect(octokit.issues.createComment).not.toBeCalled(); expect(core.warning).toBeCalledWith('Comment body cannot be blank'); diff --git a/src/main.ts b/src/main.ts index d254c3f..7915d69 100644 --- a/src/main.ts +++ b/src/main.ts @@ -35,7 +35,7 @@ async function run() { let body; if (path) { - body = readFileSync(path); + body = readFileSync(path, 'utf-8'); } else { body = message; } From b27d1a131535947450ac10064659418444ce5b0b Mon Sep 17 00:00:00 2001 From: Sebass van Boxel Date: Fri, 6 Nov 2020 09:40:11 +0100 Subject: [PATCH 2/3] Revert changes to spec file --- __tests__/comment.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/comment.test.ts b/__tests__/comment.test.ts index c02aca1..52f8acb 100644 --- a/__tests__/comment.test.ts +++ b/__tests__/comment.test.ts @@ -100,7 +100,7 @@ describe("updateComment", () => { it("without comment body and previousbody", async() => { expect( - await updateComment(octokit, repo, 456, "", null) + await updateComment(octokit, repo, 456, "", "") ).toBeUndefined(); expect(octokit.issues.updateComment).not.toBeCalled(); expect(core.warning).toBeCalledWith('Comment body cannot be blank'); @@ -136,7 +136,7 @@ describe("createComment", () => { }) it("without comment body and previousBody", async () => { expect( - await createComment(octokit, repo, 456, "", null) + await createComment(octokit, repo, 456, "", "") ).toBeUndefined(); expect(octokit.issues.createComment).not.toBeCalled(); expect(core.warning).toBeCalledWith('Comment body cannot be blank'); From 7bce870c7c5b7955056abe260f5a9efc3e7fe676 Mon Sep 17 00:00:00 2001 From: Sebass van Boxel Date: Fri, 6 Nov 2020 09:40:49 +0100 Subject: [PATCH 3/3] Build new code --- lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index d359b95..b022235 100644 --- a/lib/main.js +++ b/lib/main.js @@ -60,7 +60,7 @@ function run() { } let body; if (path) { - body = fs_1.readFileSync(path); + body = fs_1.readFileSync(path, 'utf-8'); } else { body = message;