Commit f644f7e
committed
fix(auto-fix): gate to same-repo PRs, avoid stray commits
Address review feedback on the auto-fix flow:
- Gate the PR-branch checkout and the auto-commit/push steps to
same-repository pull requests. Fork PRs previously hard-failed the
checkout (the fork's branch isn't on origin) and could not push; now
they are skipped with a warning.
- Guard against tag refs: compute the destination branch from the PR
head ref or a pushed branch ref, and skip otherwise so we never push
HEAD to refs/heads/<tag> and create a stray branch.
- Stage only tracked modifications with `git add -u` instead of
`git add -A`, so unrelated untracked/generated files are not swept
into the auto-fix commit.
- docs/permissions.md: clarify the write permission is for the
actions/checkout token, and correct the `[skip ci]` guidance (it only
matters for PAT/App-token pushes, since the default GITHUB_TOKEN push
does not trigger CI anyway).
- Example workflow: downgrade `pull-requests: write` to `read` (the
example uses no review/thread-comment feature; `read` is still needed
for files-changed-only on pull_request events).1 parent e3fd91b commit f644f7e
3 files changed
Lines changed: 51 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
462 | 465 | | |
463 | 466 | | |
464 | 467 | | |
| |||
469 | 472 | | |
470 | 473 | | |
471 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
472 | 484 | | |
473 | 485 | | |
474 | 486 | | |
| |||
531 | 543 | | |
532 | 544 | | |
533 | 545 | | |
534 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
535 | 550 | | |
536 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
537 | 568 | | |
538 | 569 | | |
539 | 570 | | |
| |||
550 | 581 | | |
551 | 582 | | |
552 | 583 | | |
553 | | - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
554 | 587 | | |
555 | 588 | | |
556 | 589 | | |
557 | 590 | | |
558 | 591 | | |
559 | 592 | | |
560 | | - | |
561 | 593 | | |
562 | 594 | | |
563 | 595 | | |
564 | 596 | | |
565 | | - | |
| 597 | + | |
566 | 598 | | |
567 | 599 | | |
568 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | | - | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
0 commit comments