Skip to content

Commit 7dc429f

Browse files
committed
Merge branch 'feat/rfc-001-federation' of https://github.com/falken10vdl/bonsaiPR
2 parents eafb044 + 392edc8 commit 7dc429f

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

automation/scripts/00_clone_merge_and_create_branch.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,23 +338,28 @@ def get_open_prs():
338338
print(f"Error fetching PRs: {response.status_code}")
339339
break
340340

341-
prs = response.json()
342-
if not prs:
341+
page_items = response.json()
342+
if not page_items:
343343
break
344344

345+
# Pagination is decided by how many items the API returned, NOT by how
346+
# many survive curation. Testing the filtered count ends the walk on the
347+
# first page for any selective profile — a page of 100 open PRs rarely
348+
# contains 100 that a curator selected — and silently yields a fraction
349+
# of the curation, or nothing at all.
350+
is_last_page = len(page_items) < params["per_page"]
351+
345352
# Apply the active curation. For the legacy/`everything` case this is
346353
# exactly the old author filter; for an `allowlist` profile it is also
347354
# what narrows 847 open PRs down to the ones the curator chose.
348-
prs = [
355+
all_prs.extend(
349356
pr
350-
for pr in prs
357+
for pr in page_items
351358
if CURATION.selects(pr["number"], (pr.get("user") or {}).get("login"))
352-
]
353-
354-
all_prs.extend(prs)
359+
)
355360
page += 1
356361

357-
if len(prs) < 100: # Last page
362+
if is_last_page:
358363
break
359364

360365
if CURATION.mode == bonsaipr_profile.MODE_ALLOWLIST:
@@ -1489,6 +1494,18 @@ def main():
14891494
applied, failed, skipped = [], [], []
14901495
failed_pr_test_results = {}
14911496
pr_conflict_data = {}
1497+
# Actually create the branch before pushing it. apply_prs_to_branch()
1498+
# normally does this, but it is skipped entirely on this path, so the
1499+
# push below used to fail with "src refspec does not match any" — an
1500+
# error that says nothing about the real problem, which is that the
1501+
# curation matched no open PRs.
1502+
original_dir = os.getcwd()
1503+
try:
1504+
os.chdir(work_dir)
1505+
subprocess.run(["git", "branch", "-D", branch_name], capture_output=True)
1506+
subprocess.run(["git", "checkout", "-b", branch_name], check=True)
1507+
finally:
1508+
os.chdir(original_dir)
14921509
# Push branch to fork (even if empty)
14931510
push_branch_to_fork(branch_name)
14941511
# Print current branch for verification

0 commit comments

Comments
 (0)