fix: make checkForExistingPullRequest check exact head/base match
This commit is contained in:
parent
339a7b6708
commit
eea524abcf
1 changed files with 6 additions and 3 deletions
|
|
@ -149,12 +149,15 @@ async function checkForExistingPullRequest(
|
||||||
const existingPRs = await listPullRequests({
|
const existingPRs = await listPullRequests({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
head,
|
|
||||||
base,
|
|
||||||
state: "open",
|
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(
|
throw new GitHubConflictError(
|
||||||
`A pull request already exists for ${head} into ${base}`
|
`A pull request already exists for ${head} into ${base}`
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue