Skip to content

Commit 69b0edc

Browse files
committed
ci: bump actions/checkout to v7.0.0 (#41084)
Bumps `actions/checkout` to v7.0.0 across all workflows. v7 refuses to check out fork-PR code under `pull_request_target` / `workflow_run` unless `allow-unsafe-pr-checkout: true` is set. Five steps intentionally check out fork-PR code in those contexts. Each is already hardened, the fork code is either built inside the landrun sandbox or run with only `contents: read`, while trust-rooted tooling is loaded from the base-repo checkout. | File | Step | Checked-out ref | Trigger | |---|---|---|---| | `.github/actions/setup-build-env/action.yml` | Checkout PR branch | `inputs.pr_branch_ref` | build_fork (`pull_request_target`) | | `.github/workflows/build_template.yml` | `post_steps` checkout | `inputs.pr_branch_ref` | build_fork (`pull_request_target`) | | `.github/workflows/PR_summary.yml` | Checkout code | `github.event.pull_request.head.sha` | `pull_request_target` | | `.github/workflows/add_label_from_diff.yaml` | Checkout branch to label | `github.event.pull_request.head.sha \|\| github.sha` | `pull_request_target` | | `.github/workflows/decls-diff.yml` | Checkout new commit | `steps.meta.outputs.new-sha` | `workflow_run` | Reapplies #41055 (reverted in #41078) #41055 opted in the three workflow-file steps but missed the two on the fork-build path `setup-build-env`'s `Checkout PR branch` (used by the `build` and `test_lint` jobs) and `build_template.yml`'s `post_steps` checkout.
1 parent 571b8a8 commit 69b0edc

40 files changed

Lines changed: 92 additions & 77 deletions

.github/actions/get-mathlib-ci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ then use the local action:
2525

2626
```yaml
2727
- name: Checkout local actions
28-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2929
with:
3030
ref: ${{ github.workflow_sha }}
3131
fetch-depth: 1

.github/actions/get-mathlib-ci/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
using: composite
3434
steps:
3535
- name: Get mathlib-ci
36-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3737
with:
3838
repository: leanprover-community/mathlib-ci
3939
ref: ${{ inputs.ref }}

.github/actions/get-tools/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ runs:
139139
140140
- name: Checkout tools branch (source build)
141141
if: ${{ steps.finalize.outputs.result == 'build' }}
142-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
142+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
143143
with:
144144
ref: ${{ inputs.tools_source_ref }}
145145
path: ${{ inputs.path }}

.github/actions/setup-build-env/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ runs:
6464
# code we build, so don't leave the GITHUB_TOKEN in pr-branch/.git/config where
6565
# that code could read it.
6666
- name: Checkout PR branch
67-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
67+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
6868
with:
6969
ref: ${{ inputs.pr_branch_ref }}
7070
fetch-depth: 1
7171
path: pr-branch
7272
persist-credentials: false
73+
# The build runs this fork PR code sandboxed (landrun) with no persisted
74+
# credentials, so checking it out under pull_request_target is safe.
75+
allow-unsafe-pr-checkout: true
7376

7477
# Create empty directories so landrun doesn't complain.
7578
- name: Create empty directories

.github/workflows/PR_summary.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
20+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2121
with:
2222
ref: ${{ github.event.pull_request.head.sha }}
2323
fetch-depth: 0
2424
path: pr-branch
2525
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
2626
persist-credentials: false
27+
# Only trusted base-repo scripts run against this checkout, so checking out
28+
# fork PR code under pull_request_target is safe.
29+
allow-unsafe-pr-checkout: true
2730

2831
- name: Checkout local actions
29-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
32+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3033
with:
3134
ref: ${{ github.workflow_sha }}
3235
fetch-depth: 1

.github/workflows/actionlint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
12+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
1313

1414
- name: suggester / actionlint
1515
uses: reviewdog/action-actionlint@6fb7acc99f4a1008869fa8a0f09cfca740837d9d # v1.72.0
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
24+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2525

2626
# Using our fork's PR branch until upstream merges the improved error reporting:
2727
# https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/pull/288

.github/workflows/add_label_from_diff.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
if: github.repository == 'leanprover-community/mathlib4'
2323
steps:
2424
- name: Checkout master branch to build autolabel from
25-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
25+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2626
with:
2727
ref: master
2828
path: tools
@@ -38,13 +38,16 @@ jobs:
3838
run: |
3939
lake build autolabel
4040
- name: Checkout branch to label
41-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
41+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4242
with:
4343
ref: ${{ github.event.pull_request.head.sha || github.sha }}
4444
fetch-depth: 0
4545
path: pr-branch
4646
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
4747
persist-credentials: false
48+
# autolabel is built from the trusted base checkout and only reads these files,
49+
# so checking out fork PR code under pull_request_target is safe.
50+
allow-unsafe-pr-checkout: true
4851
- name: Run autolabel
4952
working-directory: pr-branch
5053
run: |

.github/workflows/build_template.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
# We just populate the env vars for this step to make them viewable in the logs
8080
8181
- name: Checkout local actions
82-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
82+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
8383
with:
8484
ref: ${{ github.workflow_sha }}
8585
fetch-depth: 1
@@ -394,7 +394,7 @@ jobs:
394394
shell: landrun --rox /usr --ro /etc/timezone --rw /dev --rox /home/lean/.elan --rox /home/lean/actions-runner/_work --rox /home/lean/.cache/mathlib/ --rw pr-branch/.lake/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
395395
steps:
396396
- name: Checkout local actions
397-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
397+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
398398
with:
399399
ref: ${{ github.workflow_sha }}
400400
fetch-depth: 1
@@ -604,7 +604,7 @@ jobs:
604604
# `build_template` via `pull_request_target`, never this one — so
605605
# `pr_branch_ref` is always a trusted ref here. Fork PRs keep `master`.
606606
- name: Checkout tools branch
607-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
607+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
608608
with:
609609
ref: ${{ inputs.tools_branch_ref != '' && inputs.tools_branch_ref || (github.event.pull_request.head.repo.fork && 'master' || inputs.pr_branch_ref) }}
610610
fetch-depth: 1
@@ -674,17 +674,20 @@ jobs:
674674
contents: read
675675
steps:
676676

677-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
677+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
678678
with:
679679
ref: ${{ inputs.pr_branch_ref }}
680680
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
681681
persist-credentials: false
682+
# This job runs with only `contents: read` and no persisted credentials,
683+
# so checking out fork PR code under pull_request_target is safe.
684+
allow-unsafe-pr-checkout: true
682685

683686
# Sparse-checkout master's `.github/actions/` so the trust dispatch
684687
# below loads from a trust-rooted source, not from PR-branch-controlled
685688
# content. Mirrors the `Checkout local actions` step in the `build` job.
686689
- name: Checkout local actions
687-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
690+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
688691
with:
689692
ref: ${{ github.workflow_sha }}
690693
fetch-depth: 1
@@ -748,7 +751,7 @@ jobs:
748751
lake exe graph
749752
750753
- name: Checkout local actions
751-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
754+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
752755
with:
753756
ref: ${{ github.workflow_sha }}
754757
fetch-depth: 1

.github/workflows/cache_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run:
4242
shell: bash
4343
steps:
44-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
44+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4545

4646
# Install elan and the toolchain cross-platform. Build/test/lint, the
4747
# Mathlib cache, and the GitHub cache are all disabled, so this is a

.github/workflows/check_pr_titles.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
22+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2323
with:
2424
ref: master
2525
- name: Configure Lean

0 commit comments

Comments
 (0)