Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mheap committed Dec 8, 2024
1 parent 4fc7710 commit ce2a7e7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
22 changes: 18 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -75,7 +77,7 @@ async function action() {
octokit,
shouldAddComment,
`Unknown exit_code input [${exitType}]. Must be one of: ${allowedExitCodes.join(
", "
", ",
)}`,
issue_number,
);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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({
Expand Down
11 changes: 8 additions & 3 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
);

Expand Down Expand Up @@ -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",
},
);

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ce2a7e7

Please sign in to comment.