Skip to content

Commit eea524a

Browse files
committed
fix: make checkForExistingPullRequest check exact head/base match
1 parent 339a7b6 commit eea524a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/github/operations/pulls.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,15 @@ async function checkForExistingPullRequest(
149149
const existingPRs = await listPullRequests({
150150
owner,
151151
repo,
152-
head,
153-
base,
154152
state: "open",
155153
});
156154

157-
if (existingPRs.length > 0) {
155+
// Check if any existing open PR has the exact same head and base combination
156+
const duplicatePR = existingPRs.find(pr =>
157+
pr.head.ref === head && pr.base.ref === base
158+
);
159+
160+
if (duplicatePR) {
158161
throw new GitHubConflictError(
159162
`A pull request already exists for ${head} into ${base}`
160163
);

0 commit comments

Comments
 (0)