From ce2a7e7bb0a5b3066261e7fa9e5001a57f89acf6 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Sun, 8 Dec 2024 11:31:47 +0000 Subject: [PATCH] Fix linting --- index.js | 22 ++++++++++++++++++---- index.test.js | 11 ++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 20424d9..e04ef4a 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,9 @@ async function action() { // e.g. refs/heads/gh-readonly-queue/main/pr-17-a3c310584587d4b97c2df0cb46fe050cc46a15d6 const lastPart = github.context.ref.split("/").pop(); issue_number = lastPart.match(/pr-(\d+)-/)[1]; - core.info(`merge_group event detected and issue_number parsed as ${issue_number}`); + core.info( + `merge_group event detected and issue_number parsed as ${issue_number}`, + ); } const allowedModes = ["exactly", "minimum", "maximum"]; @@ -75,7 +77,7 @@ async function action() { octokit, shouldAddComment, `Unknown exit_code input [${exitType}]. Must be one of: ${allowedExitCodes.join( - ", " + ", ", )}`, issue_number, ); @@ -132,7 +134,13 @@ async function action() { applied: appliedLabels.join(", "), }); - await exitWithError(exitType, octokit, shouldAddComment, errorMessage, issue_number); + await exitWithError( + exitType, + octokit, + shouldAddComment, + errorMessage, + issue_number, + ); return; } @@ -167,7 +175,13 @@ function tmpl(t, o) { }); } -async function exitWithError(exitType, octokit, shouldAddComment, message, issue_number) { +async function exitWithError( + exitType, + octokit, + shouldAddComment, + message, + issue_number, +) { if (shouldAddComment) { // Is there an existing comment? const { data: existing } = await octokit.rest.issues.listComments({ diff --git a/index.test.js b/index.test.js index 7ca612c..ada2ae4 100644 --- a/index.test.js +++ b/index.test.js @@ -659,7 +659,7 @@ describe("Required Labels", () => { GITHUB_TOKEN: "mock-token-here-abc", }, { - ref: "refs/heads/gh-readonly-queue/main/pr-28-a3c310584587d4b97c2df0cb46fe050cc46a15d6" + ref: "refs/heads/gh-readonly-queue/main/pr-28-a3c310584587d4b97c2df0cb46fe050cc46a15d6", }, ); @@ -687,7 +687,7 @@ describe("Required Labels", () => { }, { // This would lead to an error as there are no mocks for PR 999 - ref: "refs/heads/gh-readonly-queue/main/pr-999-a3c310584587d4b97c2df0cb46fe050cc46a15d6" + ref: "refs/heads/gh-readonly-queue/main/pr-999-a3c310584587d4b97c2df0cb46fe050cc46a15d6", }, ); @@ -737,7 +737,12 @@ function mockListComments(comments) { ); } -function mockEvent(eventName, mockPayload, additionalParams, additionalContext = {}) { +function mockEvent( + eventName, + mockPayload, + additionalParams, + additionalContext = {}, +) { github.context.payload = mockPayload; github.context.eventName = eventName;