Skip to content

Commit e4a14cf

Browse files
committed
fix(pr): scope stale-PR sweep to same-repo PRs
1 parent 94f76d8 commit e4a14cf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

scripts/update-changelog.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,15 @@ async function main () {
418418
// delete its branch.
419419
let seedPreamble: string | null = null
420420
if (!dryRun && process.env.GITHUB_TOKEN) {
421-
const openReleasePRs = await gh<Array<{ number: number, body: string | null, head: { ref: string }, base: { ref: string }, updated_at: string }>>(
422-
`/repos/${repo.owner}/${repo.repo}/pulls?state=open&per_page=100&base=${encodeURIComponent(baseBranch)}`,
421+
const openReleasePRs = await gh<Array<{ number: number, body: string | null, head: { ref: string, repo: { full_name: string } | null }, base: { ref: string }, updated_at: string }>>(
422+
`/repos/${repo.owner}/${repo.repo}/pulls?state=open&per_page=100&base=${encodeURIComponent(baseBranch)}&head=${repo.owner}:`,
423423
{ requireAuth: true },
424424
)
425+
const sameRepo = `${repo.owner}/${repo.repo}`
425426
const stale = openReleasePRs
426427
.filter(pr =>
427-
pr.head.ref.startsWith('release/v')
428+
pr.head.repo?.full_name === sameRepo
429+
&& pr.head.ref.startsWith('release/v')
428430
&& pr.head.ref !== releaseBranch
429431
&& pr.base.ref === baseBranch,
430432
)

0 commit comments

Comments
 (0)