From ccfaa08e51332afc5ae6ffecb06a70116cf8c2bd Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Fri, 30 Aug 2024 17:47:25 +0100 Subject: [PATCH] Reformat based on prettier --- index.js | 18 +++++++++--------- index.test.js | 42 +++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index 5d48bee..f13c8c8 100644 --- a/index.js +++ b/index.js @@ -50,8 +50,8 @@ async function action() { octokit, shouldAddComment, `Unknown mode input [${mode}]. Must be one of: ${allowedModes.join( - ", " - )}` + ", ", + )}`, ); return; } @@ -63,8 +63,8 @@ async function action() { octokit, shouldAddComment, `Unknown exit_code input [${exitType}]. Must be one of: ${allowedExitCodes.join( - ", " - )}` + ", ", + )}`, ); return; } @@ -86,15 +86,15 @@ async function action() { if (labelsAreRegex) { intersection = appliedLabels.filter((appliedLabel) => providedLabels.some((providedLabel) => - new RegExp(providedLabel, "i").test(appliedLabel) - ) + new RegExp(providedLabel, "i").test(appliedLabel), + ), ); } else { const lowerCasedAppliedLabels = appliedLabels.map((label) => - label.toLowerCase() + label.toLowerCase(), ); intersection = providedLabels.filter((x) => - lowerCasedAppliedLabels.includes(x.toLowerCase()) + lowerCasedAppliedLabels.includes(x.toLowerCase()), ); } @@ -131,7 +131,7 @@ async function action() { }); const generatedComment = existing.find((c) => - c.body.includes(matchToken) + c.body.includes(matchToken), ); if (generatedComment) { await octokit.rest.issues.deleteComment({ diff --git a/index.test.js b/index.test.js index 8d8a46b..3ae51a1 100644 --- a/index.test.js +++ b/index.test.js @@ -41,8 +41,8 @@ describe("Required Labels", () => { if (!nock.isDone()) { throw new Error( `Not all nock interceptors were used: ${JSON.stringify( - nock.pendingMocks() - )}` + nock.pendingMocks(), + )}`, ); } nock.cleanAll(); @@ -80,7 +80,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "failure"); expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhancement. Found: bug" + "Label error. Requires exactly 1 of: enhancement. Found: bug", ); }); @@ -254,7 +254,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "failure"); expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug", ); }); @@ -273,7 +273,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "failure"); expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhance.*, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhance.*, bug. Found: enhancement, bug", ); }); @@ -292,7 +292,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "failure"); expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhance.*, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhance.*, bug. Found: enhancement, bug", ); }); @@ -310,7 +310,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "failure"); expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires at least 2 of: enhancement, bug, triage. Found: enhancement" + "Label error. Requires at least 2 of: enhancement, bug, triage. Found: enhancement", ); }); @@ -327,7 +327,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "failure"); expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires at most 2 of: enhancement, bug, triage. Found: enhancement, triage, bug" + "Label error. Requires at most 2 of: enhancement, bug, triage. Found: enhancement, triage, bug", ); }); }); @@ -340,7 +340,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Input required and not supplied: mode" + "Input required and not supplied: mode", ); }); @@ -354,7 +354,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Input required and not supplied: count" + "Input required and not supplied: count", ); }); @@ -368,7 +368,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Input required and not supplied: labels" + "Input required and not supplied: labels", ); }); @@ -383,7 +383,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Unknown mode input [bananas]. Must be one of: exactly, minimum, maximum" + "Unknown mode input [bananas]. Must be one of: exactly, minimum, maximum", ); }); @@ -399,7 +399,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Unknown exit_code input [other]. Must be one of: success, failure" + "Unknown exit_code input [other]. Must be one of: success, failure", ); }); }); @@ -476,7 +476,7 @@ describe("Required Labels", () => { expect(core.setOutput).toBeCalledWith("status", "success"); expect(core.setOutput).toBeCalledWith( "labels", - "Needs Code Review,Needs QA Review" + "Needs Code Review,Needs QA Review", ); }); }); @@ -494,7 +494,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug", ); }); @@ -511,7 +511,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug", ); }); @@ -528,7 +528,7 @@ describe("Required Labels", () => { expect(core.warning).toBeCalledTimes(1); expect(core.warning).toBeCalledWith( - "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug", ); }); }); @@ -547,7 +547,7 @@ describe("Required Labels", () => { expect(core.setFailed).toBeCalledTimes(1); expect(core.setFailed).toBeCalledWith( - "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug" + "Label error. Requires exactly 1 of: enhancement, bug. Found: enhancement, bug", ); }); @@ -657,7 +657,7 @@ function mockPr(env) { labels: [], }, }, - env + env, ); } @@ -668,7 +668,7 @@ function mockLabels(labels) { 200, labels.map((name) => { return { name }; - }) + }), ); } @@ -679,7 +679,7 @@ function mockListComments(comments) { 200, comments.map((c) => { return { body: c.body, id: c.id }; - }) + }), ); }