format-suggest workflow fails on all fork PRs since actions/checkout blocked pull_request_target checkouts
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
Direzione di ricerca
Inizia da .github/workflows/format-suggest.yaml e confronta il relativo passaggio di checkout con il template posit-dev/setup-air collegato. Esamina le indicazioni di sicurezza di pull_request_target prima di scegliere l’opzione di checkout documentata o la separazione più restrittiva del workflow. Il lavoro è completato quando le pull request provenienti da fork possono eseguire correttamente format-suggest senza esporre i secret del repository né eseguire codice non attendibile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- R
- Stelle
- 2.5k
- Fork
- 760
- Merge medio
- 1g 6h
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di r-lib/devtools
-
`dev_sitrep()` says to update with `pak::pak("somePackage")` but doing so doesn't change the reportForse già presa @fabiandistler l’ha presa 82 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
devtools::load_all() has an extra warning that pkgload::load_all() doesn'tForse già presa @emstruong l’ha presa 278 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Respect `vacation.dcf`Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
Tutte le issue di r-lib/devtools
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
hubverse-org/hubDevs#83 ·
-
data_bio2rarify - doc - dimensions wrongForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
leppott/BioMonTools#162 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
-
publications
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
epiforecasts/epiforecasts.github.io#161 ·
I maintainer di solito rispondono entro 1 giorno