Allow PR merge when GitHub reports it ready (#1172)

This commit is contained in:
Mohamed Boudra
2026-05-25 10:05:35 +00:00
committed by GitHub
parent 8a2e5c786e
commit 1e68283565
2 changed files with 51 additions and 7 deletions
+42
View File
@@ -226,6 +226,9 @@ describe("git-actions-policy", () => {
"merge-from-base",
"merge-branch",
"pr",
"merge-pr-squash",
"merge-pr-merge",
"merge-pr-rebase",
]);
expect(
actions.secondary.some((action) => action.id === "pr" && action.label === "View PR"),
@@ -324,6 +327,45 @@ describe("git-actions-policy", () => {
});
});
it("offers direct PR merge when GitHub says the PR is mergeable even if the local branch is behind", () => {
const actions = buildGitActions(
createInput({
hasRemote: true,
isOnBaseBranch: false,
aheadCount: 2,
behindBaseCount: 3,
aheadOfOrigin: 0,
behindOfOrigin: 2,
hasPullRequest: true,
pullRequestUrl: "https://example.com/pr/456",
pullRequestState: "open",
pullRequestMergeable: "MERGEABLE",
pullRequestGithub: githubStatus({ mergeStateStatus: "CLEAN" }),
shipDefault: "pr",
}),
);
expect(actions.secondary).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: "merge-pr-squash",
disabled: false,
unavailableMessage: undefined,
}),
expect.objectContaining({
id: "merge-pr-merge",
disabled: false,
unavailableMessage: undefined,
}),
expect.objectContaining({
id: "merge-pr-rebase",
disabled: false,
unavailableMessage: undefined,
}),
]),
);
});
it("respects the ship preference when choosing between PR merge and local merge", () => {
const prPreferredActions = buildGitActions(
createInput({