format-suggest workflow fails on all fork PRs since actions/checkout blocked pull_request_target checkouts
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
調査の方向性
.github/workflows/format-suggest.yaml から始め、その checkout ステップをリンクされている posit-dev/setup-air テンプレートと比較してください。文書化されている checkout オプションまたはより厳格な workflow 分割のどちらを選ぶか決める前に、pull_request_target のセキュリティガイダンスを確認してください。フォークからの pull request が、リポジトリのシークレットを公開したり、信頼できないコードを実行したりすることなく、format-suggest を正常に実行できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- R
- スター
- 2.5k
- フォーク
- 760
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
r-lib/devtools のほかの issue
-
`dev_sitrep()` says to update with `pak::pak("somePackage")` but doing so doesn't change the report対応中かも @fabiandistler が 82 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
devtools::load_all() has an extra warning that pkgload::load_all() doesn't対応中かも @emstruong が 278 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
hubverse-org/hubDevs#83 ·
-
data_bio2rarify - doc - dimensions wrong対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
leppott/BioMonTools#162 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
-
publications
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
epiforecasts/epiforecasts.github.io#161 ·
メンテナーはふだん 1 日以内に返信