format-suggest workflow fails on all fork PRs since actions/checkout blocked pull_request_target checkouts
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 86/100
Piste de recherche
Commencez par .github/workflows/format-suggest.yaml et comparez son étape de checkout avec le modèle posit-dev/setup-air associé. Consultez les recommandations de sécurité de pull_request_target avant de choisir l’option de checkout documentée ou la séparation plus stricte du workflow. Le travail est terminé lorsque les pull requests provenant de forks peuvent exécuter format-suggest avec succès sans exposer les secrets du dépôt ni exécuter de code non fiable.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- R
- Étoiles
- 2.5k
- Forks
- 762
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 3
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de r-lib/devtools
-
`dev_sitrep()` says to update with `pak::pak("somePackage")` but doing so doesn't change the reportPeut-être pris @fabiandistler l’a pris il y a 82 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 52/100
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
-
devtools::load_all() has an extra warning that pkgload::load_all() doesn'tPeut-être pris @emstruong l’a pris il y a 279 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
-
Respect `vacation.dcf`Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
Toutes les issues de r-lib/devtools
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
hubverse-org/hubDevs#83 ·
-
data_bio2rarify - doc - dimensions wrongPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
leppott/BioMonTools#162 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
r-lib/rig#535 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100