Commit 6feea4a
Do not fail the sweep when a head branch is reused by a newer pull request
Now that the sweep runs to completion it surfaces a condition that was
previously unreachable. When a contributor closes a pull request and then
reuses its head branch for a new one, the head branch no longer points at
the SHA the closed pull request recorded. `delete_branch` correctly refuses
to delete it -- deleting it would break the newer pull request -- but it
reported that refusal as a failure, so the whole run went red.
That state is permanent for as long as the newer pull request stays open, so
the workflow would have been red on every run indefinitely. That is the same
alert fatigue the previous fix set out to remove, just from a different
cause. `jdeniau-GHSA-xvcm-6775-5m9r` is a live example: pull request 9129 was
closed, one more commit was pushed to its head branch, and pull request 9226
was opened from it and is still open.
Reusing a branch this way is a normal contributor pattern here, not an
operational fault, and it needs no human intervention: once the newer pull
request is closed its own cleanup removes the branch, the older pull
request's head then reads as already absent, and the leftover staging branch
is collected on the next sweep. Treat it the way the other "nothing safe to
do here" states are already treated -- still open, fork-headed, deleted --
and skip it instead of failing.
`delete_branch` now returns 3 for this case specifically, so a genuine
deletion failure is still a failure and still stops the staging branch from
being deleted after it. Nothing that was previously deleted is deleted any
differently; only the reporting changes.
Record the skipped branches and write them to the job summary along with the
sweep counters, so they stay visible without being buried in a 1,600-line log
and without holding the run red.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: daca0885-6779-4adb-bb02-ff6920d73ab31 parent a92e708 commit 6feea4a
1 file changed
Lines changed: 80 additions & 7 deletions
Lines changed: 80 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
| |||
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | | - | |
| 207 | + | |
198 | 208 | | |
199 | 209 | | |
200 | 210 | | |
| |||
274 | 284 | | |
275 | 285 | | |
276 | 286 | | |
277 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
278 | 293 | | |
279 | 294 | | |
280 | 295 | | |
| |||
284 | 299 | | |
285 | 300 | | |
286 | 301 | | |
287 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
288 | 310 | | |
289 | 311 | | |
290 | 312 | | |
| |||
393 | 415 | | |
394 | 416 | | |
395 | 417 | | |
396 | | - | |
| 418 | + | |
| 419 | + | |
397 | 420 | | |
398 | 421 | | |
399 | 422 | | |
400 | 423 | | |
401 | 424 | | |
402 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
403 | 468 | | |
404 | 469 | | |
405 | 470 | | |
406 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
407 | 478 | | |
408 | 479 | | |
409 | 480 | | |
| |||
416 | 487 | | |
417 | 488 | | |
418 | 489 | | |
| 490 | + | |
419 | 491 | | |
420 | 492 | | |
421 | | - | |
| 493 | + | |
| 494 | + | |
422 | 495 | | |
423 | 496 | | |
424 | 497 | | |
| |||
0 commit comments