Skip to content

Commit 288ed97

Browse files
authored
Merge branch 'master' into h1connected
2 parents 73629ea + ac47869 commit 288ed97

1,993 files changed

Lines changed: 26339 additions & 14502 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/cache-trust-dispatch/action.yml

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Single source of truth mapping (repo, branch) → (upload container,
1+
# Single source of truth mapping (repo, ref) → (upload container,
22
# read fallback chain) for Mathlib's multi-container cache.
33
#
44
# Called by build, upload_cache, and post_steps in build_template.yml so
@@ -14,7 +14,10 @@ inputs:
1414
description: GitHub repo full name (`owner/name`).
1515
required: true
1616
branch:
17-
description: Branch name (`github.head_ref || github.ref_name`).
17+
description: |
18+
Branch name (`github.head_ref || github.ref_name`); on tag-triggered
19+
runs this is the tag name, distinguished via `github.ref_type` inside
20+
the dispatch step.
1821
required: true
1922
head-sha:
2023
description: |
@@ -55,6 +58,10 @@ runs:
5558
REPO="${{ inputs.repo }}"
5659
BRANCH="${{ inputs.branch }}"
5760
HEAD_SHA="${{ inputs.head-sha }}"
61+
# Whether `branch` names a branch or a tag. Read from the run context
62+
# rather than an input: unlike `repo`/`branch`, the value does not
63+
# depend on which event shape (PR vs push) the caller handles.
64+
REF_TYPE="${{ github.ref_type }}"
5865
PRIMARY=""
5966
READ_CHAIN=""
6067
REPO_SCOPE=""
@@ -80,30 +87,55 @@ runs:
8087
else
8188
case "$REPO" in
8289
"leanprover-community/mathlib4")
83-
case "$BRANCH" in
84-
"master"|"staging")
85-
# Master / staging are the only writers that feed `master`
86-
# (`staging` is bors's merge candidate, which fast-forwards to
87-
# `master`). Read `master` only, not the default [master,
88-
# legacy]: files the read chain serves are skipped at stage
89-
# time, so keeping `legacy` would leave legacy-only files out of
90-
# `master` for good. Reading `master` alone turns them into
91-
# misses that get rebuilt and uploaded, so `master` fills itself
92-
# into a standalone cache. (Only PRIMARY=master does this; other
93-
# runs write to `forks` and keep the wider chain.)
94-
PRIMARY="master"
95-
READ_CHAIN="master"
96-
;;
97-
*)
98-
# `bors trying`, `ci-dev/*`, maintainer dev branches on the
99-
# canonical repo: trust level is fork-equivalent (the OIDC
100-
# token's RBAC scopes them to `forks`). Reads must widen
101-
# past the default [master, legacy] so the post-build
102-
# verification finds the just-uploaded fork-trust artifacts.
103-
PRIMARY="forks"
104-
READ_CHAIN="master,forks,legacy"
105-
;;
106-
esac
90+
if [ "$REF_TYPE" = "tag" ]; then
91+
case "$BRANCH" in
92+
v4.*)
93+
# `v4.*` release tags: release_cache.yml rebuilds off-master
94+
# release commits (patch releases, patched release
95+
# candidates) and publishes them into `master`, the container
96+
# canonical checkouts read. Tag creation is restricted to
97+
# release managers by a tag ruleset, and the
98+
# `cache-upload-master` environment admits `v4.*` tag refs,
99+
# so these builds carry master trust. Reads are `master`-only
100+
# for the same fill-in reason as the master/staging arm
101+
# below.
102+
PRIMARY="master"
103+
READ_CHAIN="master"
104+
;;
105+
*)
106+
# Other tags have no trust class of their own:
107+
# fork-equivalent, like the dev-branch arm below.
108+
PRIMARY="forks"
109+
READ_CHAIN="master,forks,legacy"
110+
;;
111+
esac
112+
else
113+
case "$BRANCH" in
114+
"master"|"staging")
115+
# Master, staging, and `v4.*` release tags (above) are the
116+
# only writers that feed `master` (`staging` is bors's merge
117+
# candidate, which fast-forwards to `master`). Read `master`
118+
# only, not the default [master, legacy]: files the read
119+
# chain serves are skipped at stage time, so keeping `legacy`
120+
# would leave legacy-only files out of `master` for good.
121+
# Reading `master` alone turns them into misses that get
122+
# rebuilt and uploaded, so `master` fills itself into a
123+
# standalone cache. (Only PRIMARY=master does this; other
124+
# runs write to `forks` and keep the wider chain.)
125+
PRIMARY="master"
126+
READ_CHAIN="master"
127+
;;
128+
*)
129+
# `bors trying`, `ci-dev/*`, maintainer dev branches on the
130+
# canonical repo: trust level is fork-equivalent (the OIDC
131+
# token's RBAC scopes them to `forks`). Reads must widen
132+
# past the default [master, legacy] so the post-build
133+
# verification finds the just-uploaded fork-trust artifacts.
134+
PRIMARY="forks"
135+
READ_CHAIN="master,forks,legacy"
136+
;;
137+
esac
138+
fi
107139
;;
108140
"leanprover-community/mathlib4-nightly-testing")
109141
case "$BRANCH" in

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
# Default pinned commit used by workflows unless they explicitly override.
1111
# Update this ref as needed to pick up changes to mathlib-ci scripts
1212
# This is also updated automatically by .github/workflows/update_dependencies.yml
13-
default: 5668fbbccf0fecefdfcddf539b8406db197dfc59
13+
default: 57c68e7faac5aea96e58a94ca4a334a1999f0d31
1414
path:
1515
description: Checkout destination path.
1616
required: false

.github/workflows/PR_summary.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
20+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2121
with:
2222
ref: ${{ github.event.pull_request.head.sha }}
2323
fetch-depth: 0
@@ -29,7 +29,7 @@ jobs:
2929
allow-unsafe-pr-checkout: true
3030

3131
- name: Checkout local actions
32-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
32+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3333
with:
3434
ref: ${{ github.workflow_sha }}
3535
fetch-depth: 1
@@ -67,7 +67,7 @@ jobs:
6767
fi
6868
6969
- name: Set up Python
70-
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
70+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
7171
with:
7272
python-version: 3.12
7373

@@ -220,12 +220,23 @@ jobs:
220220
else
221221
declDiff="$(printf '#### Declarations diff (regex)\n\n%s\n' "${declDiff}")"
222222
fi
223-
# Append a placeholder for the post-build, Lean-aware diff. The
224-
# `decls-diff.yml` workflow replaces the region between the markers (see
225-
# mathlib-ci's `updateDeclsDiffSection.py`); the regex block above is left
226-
# as-is. The markers are HTML comments (invisible when rendered), and the
227-
# heading carries the status (`pending` → `(Lean)` / `(Lean -- unavailable)`).
228-
declDiff="$(printf '%s\n\n<!-- DECLS_DIFF_LEAN_BEGIN -->\n#### Declarations diff (Lean -- pending)\n\n_Computed after the build finishes._\n<!-- DECLS_DIFF_LEAN_END -->\n' "${declDiff}")"
223+
# Append the post-build, Lean-aware diff region. The `decls-diff.yml`
224+
# workflow later replaces the content between the markers (see mathlib-ci's
225+
# `updateDeclsDiffSection.py`); the regex block above is left as-is. The
226+
# markers are HTML comments (invisible when rendered), and the heading
227+
# carries the status (`pending` → `(Lean)` / `(Lean -- unavailable)`).
228+
#
229+
# Because this pre-build step rewrites the whole comment, it would otherwise
230+
# blank a previously-shown diff back to `pending` on every push. Instead we
231+
# ask `updateDeclsDiffSection.py` (MODE=emit) to carry the existing real diff
232+
# forward — relabelled stale — so it stays visible until the new build lands;
233+
# on the first run (or with no prior diff) it prints the pending placeholder.
234+
leanRegion="$(MODE=emit \
235+
NEW_HEADING='#### Declarations diff (Lean -- stale, waiting for the new build)' \
236+
REPO="${{ github.repository }}" PR_NUMBER="${PR}" PR_HEAD_SHA="${currentHash}" \
237+
python3 "${CI_SCRIPTS_DIR}/pr_summary/updateDeclsDiffSection.py" \
238+
|| printf '#### Declarations diff (Lean -- pending)\n\n_Computed after the build finishes._')"
239+
declDiff="$(printf '%s\n\n<!-- DECLS_DIFF_LEAN_BEGIN -->\n%s\n<!-- DECLS_DIFF_LEAN_END -->\n' "${declDiff}" "${leanRegion}")"
229240
git checkout "${currentHash}" --
230241
hashURL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}/commits/${currentHash}"
231242
printf 'hashURL: %s' "${hashURL}"

.github/workflows/actionlint.yml

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

1414
- name: suggester / actionlint
15-
uses: reviewdog/action-actionlint@6fb7acc99f4a1008869fa8a0f09cfca740837d9d # v1.72.0
15+
uses: reviewdog/action-actionlint@50842263c20a7c46bd0065b9e624d3c569db061e # v1.73.0
1616
with:
1717
tool_name: actionlint
1818
fail_level: any
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
24+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: Autolabel PRs
33
on:
44
pull_request_target:
55
types: [opened]
6-
push:
7-
paths:
8-
- scripts/autolabel.lean
9-
- .github/workflows/add_label_from_diff.yaml
106

117
# Limit permissions for GITHUB_TOKEN for the entire workflow
128
permissions:
@@ -22,7 +18,7 @@ jobs:
2218
if: github.repository == 'leanprover-community/mathlib4'
2319
steps:
2420
- name: Checkout master branch to build autolabel from
25-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
21+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2622
with:
2723
ref: master
2824
path: tools
@@ -38,7 +34,7 @@ jobs:
3834
run: |
3935
lake build autolabel
4036
- name: Checkout branch to label
41-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
37+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4238
with:
4339
ref: ${{ github.event.pull_request.head.sha || github.sha }}
4440
fetch-depth: 0
@@ -51,31 +47,7 @@ jobs:
5147
- name: Run autolabel
5248
working-directory: pr-branch
5349
run: |
54-
labels="$("${GITHUB_WORKSPACE}/tools/.lake/build/bin/autolabel")"
55-
printf '%s\n' "${labels}"
56-
# extract
57-
label="$(printf '%s' "${labels}" | sed -n 's=^::notice::.*#\[\([^,]*\)\].*=\1=p')"
58-
printf 'label: "%s"\n' "${label}"
59-
if [ -n "${label}" ] && [ -n "${PR_NUMBER}" ]
60-
then
61-
printf 'Applying label %s\n' "${label}"
62-
# we use curl rather than octokit/request-action so that the job won't fail
63-
# (and send an annoying email) if the labels don't exist
64-
url="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/labels"
65-
printf 'url: %s\n' "${url}"
66-
jsonLabel="$(printf '{"labels":["%s"]}' "${label}")"
67-
printf 'jsonLabel: %s\n' "${jsonLabel}"
68-
curl --request POST \
69-
--header 'Accept: application/vnd.github+json' \
70-
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
71-
--header 'X-GitHub-Api-Version: 2022-11-28' \
72-
--url "${url}" \
73-
--data "${jsonLabel}"
74-
else
75-
echo "There is no single label that we could apply, so we are not applying any label."
76-
fi
50+
"${GITHUB_WORKSPACE}/tools/.lake/build/bin/autolabel" --pr "${{ github.event.pull_request.number }}" --curl "${{ secrets.GITHUB_TOKEN }}"
7751
env:
7852
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
# the PR number could be undefined in workflows triggered by 'push',
80-
# in which case we only log the applicable label and exit
8153
PR_NUMBER: ${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)