Skip to content

Commit

Permalink
Fix merge_group tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mheap committed Dec 8, 2024
1 parent 84ca23b commit 4fc7710
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function action() {

let issue_number = github.context.issue.number;

if (github.context.eventName === "merge_group") {
if (github.context.eventName === "merge_group" && !issue_number) {
// Parse out of the ref for merge queue
// e.g. refs/heads/gh-readonly-queue/main/pr-17-a3c310584587d4b97c2df0cb46fe050cc46a15d6
const lastPart = github.context.ref.split("/").pop();
Expand Down
8 changes: 4 additions & 4 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("Required Labels", () => {
core.setOutput = jest.fn();
core.warning = jest.fn();
core.setFailed = jest.fn();
core.debug = jest.fn();
});

afterEach(() => {
Expand Down Expand Up @@ -644,13 +645,12 @@ describe("Required Labels", () => {

await action();
});

});

describe("merge_queue", () => {
describe("merge_group", () => {
it("extracts the PR number from the ref if needed", async () => {
restoreTest = mockEvent(
"merge_queue",
"merge_group",
{},
{
INPUT_LABELS: "enhancement",
Expand All @@ -673,7 +673,7 @@ describe("Required Labels", () => {

it("prefers the issue number that is set in the payload to extracting from a ref", async () => {
restoreTest = mockEvent(
"merge_queue",
"merge_group",
{
issue: {
number: 28,
Expand Down

0 comments on commit 4fc7710

Please sign in to comment.