diff --git a/.github/workflows/issue-write.yml b/.github/workflows/issue-write.yml index 153734972e846c..58c3bb33d16868 100644 --- a/.github/workflows/issue-write.yml +++ b/.github/workflows/issue-write.yml @@ -93,7 +93,10 @@ jobs: var pr_number = 0; gql_result.repository.ref.associatedPullRequests.nodes.forEach((pr) => { - if (pr.baseRepository.owner.login = context.repo.owner && pr.state == 'OPEN') { + + // The largest PR number is the one we care about. The only way to have two associated + // pull requests is if all the old pull requests in the closed state. + if (pr.baseRepository.owner.login = context.repo.owner && pr.number > pr_number) { pr_number = pr.number; } });