Skip to content

Commit

Permalink
fix: make checkForExistingPullRequest check exact head/base match
Browse files Browse the repository at this point in the history
  • Loading branch information
txbm committed Dec 28, 2024
1 parent 811bbd7 commit d61e42b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/github/operations/pulls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,15 @@ async function checkForExistingPullRequest(
const existingPRs = await listPullRequests({
owner,
repo,
head,
base,
state: "open",
});

if (existingPRs.length > 0) {
// Check if any existing open PR has the exact same head and base combination
const duplicatePR = existingPRs.find(pr =>
pr.head.ref === head && pr.base.ref === base
);

if (duplicatePR) {
throw new GitHubConflictError(
`A pull request already exists for ${head} into ${base}`
);
Expand Down

0 comments on commit d61e42b

Please sign in to comment.