Skip to content

Commit ef6afc1

Browse files
committed
fail workflow if queue is not enabled
1 parent 92188ee commit ef6afc1

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32025,8 +32025,8 @@ async function processPR(octokit, owner, repo, prNumber, config) {
3202532025

3202632026
const mqEnabled = await isMergeQueueEnabled(octokit, owner, repo, pr.baseRefName);
3202732027
if (!mqEnabled) {
32028-
core.warning(
32029-
`PR #${prNumber}: merge queue is not enabled for branch "${pr.baseRefName}" — skipping`
32028+
core.setFailed(
32029+
`Merge queue is not enabled for branch "${pr.baseRefName}". Enable it under Settings → Branches → branch protection rules.`
3203032030
);
3203132031
return;
3203232032
}

src/__tests__/index.test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe("enqueue-pullrequest action", () => {
109109
expect(core.setFailed).not.toHaveBeenCalled();
110110
});
111111

112-
test("warns and skips when merge queue is not enabled for the base branch", async () => {
112+
test("fails the workflow when merge queue is not enabled for the base branch", async () => {
113113
setupInputs();
114114
mockOctokit.graphql
115115
.mockResolvedValueOnce({ repository: { pullRequest: makePRPayload() } })
@@ -118,10 +118,9 @@ describe("enqueue-pullrequest action", () => {
118118
await runAction();
119119

120120
expect(mockOctokit.graphql).toHaveBeenCalledTimes(2);
121-
expect(core.warning).toHaveBeenCalledWith(
122-
expect.stringContaining("merge queue is not enabled")
121+
expect(core.setFailed).toHaveBeenCalledWith(
122+
expect.stringContaining("Merge queue is not enabled")
123123
);
124-
expect(core.setFailed).not.toHaveBeenCalled();
125124
});
126125

127126
test("skips a closed PR without calling enqueue", async () => {

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ async function processPR(octokit, owner, repo, prNumber, config) {
186186

187187
const mqEnabled = await isMergeQueueEnabled(octokit, owner, repo, pr.baseRefName);
188188
if (!mqEnabled) {
189-
core.warning(
190-
`PR #${prNumber}: merge queue is not enabled for branch "${pr.baseRefName}" — skipping`
189+
core.setFailed(
190+
`Merge queue is not enabled for branch "${pr.baseRefName}". Enable it under Settings → Branches → branch protection rules.`
191191
);
192192
return;
193193
}

0 commit comments

Comments
 (0)