format-suggest workflow fails on all fork PRs since actions/checkout blocked pull_request_target checkouts
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 86/100
Rechercherichtung
Beginnen Sie mit .github/workflows/format-suggest.yaml und vergleichen Sie dessen Checkout-Schritt mit der verknüpften posit-dev/setup-air-Vorlage. Prüfen Sie die Sicherheitsrichtlinien für pull_request_target, bevor Sie die dokumentierte Checkout-Option oder die strengere Aufteilung des Workflows auswählen. Als erledigt gilt die Aufgabe, wenn Pull Requests aus Forks format-suggest erfolgreich ausführen können, ohne Repository-Secrets offenzulegen oder nicht vertrauenswürdigen Code auszuführen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
format-suggest.yaml now fails on every pull request coming from a fork. It dies after ~5s in the actions/checkout step with:
Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access.
Example: #2703 (fork PR, format-suggest failed 2026-09-02). For comparison, #2699 (also a fork PR) still passed on 2026-06-19.
Cause
GitHub changed the default behaviour of actions/checkout: checking out a fork's head SHA under pull_request_target (or workflow_run) is refused unless explicitly opted in. Announced 2026-06-18 for v7, backported to the other supported major versions with enforcement on 2026-07-20 — which is why actions/checkout@v4 (a floating major tag) picked it up without any change on our side.
Since pull_request_target runs the workflow definition from the base branch, contributors cannot fix this in their PRs; it has to be changed on main.
Suggested fix
The upstream template this workflow is derived from, posit-dev/setup-air/examples/format-suggest.yaml, has already been updated:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
allow-unsafe-pr-checkout: true
vs. the current .github/workflows/format-suggest.yaml:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
allow-unsafe-pr-checkout: true is the documented opt-out. It is defensible for this workflow because the checked-out tree is only treated as passive data (air format . does not execute package code), which is the exact use case GitHub calls out as acceptable — but it is worth a conscious decision rather than a copy-paste, so I did not open a PR for it.
The stricter alternative, if you'd rather not opt out at all, is the two-workflow split: run air format . under pull_request (no secrets), upload the diff as an artifact, and post the suggestions from a separate workflow_run job that never checks out fork code.
Other r-lib repos deriving from the same template are presumably affected identically.
References
- Vorherrschende Sprache
- R
- Sterne
- 2.5k
- Forks
- 762
- Ø Merge
- 1 T. 6 Std.
- Gemergte PRs (30 T.)
- 3
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus r-lib/devtools
-
`dev_sitrep()` says to update with `pak::pak("somePackage")` but doing so doesn't change the reportEvtl. vergeben @fabiandistler hat das vor 82 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 52/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
-
devtools::load_all() has an extra warning that pkgload::load_all() doesn'tEvtl. vergeben @emstruong hat das vor 279 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
-
Respect `vacation.dcf`Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
hubverse-org/hubDevs#83 ·
-
data_bio2rarify - doc - dimensions wrongEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
leppott/BioMonTools#162 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
r-lib/rig#535 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag