Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/auto_update_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def step(self, event: str, now: datetime) -> int | None:
log("auto_update.release", pr=p.number, failed=ci_failed(p))
self.set_label(p.number, False)
p.labels.discard(self.label)
elif event == "push" and ci_running(p, now, self.max_age):
elif event == "push" and ci_running(p, now, self.max_age) and self.merge_state(p.number)[1] == "BEHIND":
log("auto_update.restart", pr=p.number, reason="base moved while its CI ran")
self.cancel_runs(p)
self.update(p)
Expand Down
8 changes: 8 additions & 0 deletions .github/scripts/test_auto_update_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ def test_push_restarts_labelled_pr_with_running_ci(self) -> None:
self.assertEqual(fake.cancelled(), ["repos/o/r/actions/runs/7/cancel"])
self.assertEqual(fake.updated(), ["1"])

def test_push_leaves_up_to_date_labelled_pr_running(self) -> None:
runs = [{"id": 7, "status": "in_progress"}]
fake = FakeGh([pr(1, labels=("auto-update",), checks=[RUNNING]), pr(2)],
states={1: ("MERGEABLE", "BLOCKED")}, runs=runs)
self.assertIsNone(updater(fake).step("push", NOW))
self.assertEqual(fake.cancelled(), [])
self.assertEqual(fake.updated(), [])

def test_schedule_waits_for_labelled_pr_with_running_ci(self) -> None:
fake = FakeGh([pr(1, labels=("auto-update",), checks=[RUNNING]), pr(2)])
self.assertIsNone(updater(fake).step("schedule", NOW))
Expand Down
Loading