Skip to content

Commit fd986b3

Browse files
authored
Merge branch 'master' into partial-type
2 parents d72d1ea + 1fb9173 commit fd986b3

1,424 files changed

Lines changed: 26173 additions & 11582 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/workflows/build_template.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -816,17 +816,7 @@ jobs:
816816
needs: [style_lint, build, post_steps]
817817
runs-on: ubuntu-latest
818818
steps:
819-
- name: Generate auto merge app token
820-
id: auto-merge-app-token
821-
uses: leanprover-community/mathlib-ci/.github/actions/azure-create-github-app-token@3bb576208589a435eeaeac9b144a1b7c3e948760
822-
with:
823-
app-id: ${{ secrets.MATHLIB_AUTO_MERGE_APP_ID }}
824-
key-vault-name: ${{ vars.MATHLIB_AZ_KEY_VAULT_NAME }}
825-
key-name: mathlib-auto-merge-app-pk
826-
azure-client-id: ${{ vars.GH_APP_AZURE_CLIENT_ID_CI_AUTO_MERGE }}
827-
azure-tenant-id: ${{ secrets.LPC_AZ_TENANT_ID }}
828-
829-
- id: PR_from_push
819+
- id: PR
830820
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
831821
# TODO: this may not work properly if the same commit is pushed to multiple branches:
832822
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -835,16 +825,6 @@ jobs:
835825
# Only return if PR is still open
836826
filterOutClosed: true
837827

838-
# TODO: delete this step and rename `PR_from_push` to `PR` if the above step seems to work properly
839-
# Combine the output from the previous action with the metadata supplied by GitHub itself.
840-
# Note that if we fall back to github.event.pull_request data, the list of labels is generated when this workflow is triggered
841-
# and not updated afterwards!
842-
- id: PR
843-
shell: bash
844-
run: |
845-
echo "number=${{ steps.PR_from_push.outputs.number || github.event.pull_request.number }}" | tee -a "$GITHUB_OUTPUT"
846-
echo "pr_labels=${{ steps.PR_from_push.outputs.pr_labels || join(github.event.pull_request.labels.*.name, ',') }}" | tee -a "$GITHUB_OUTPUT"
847-
848828
- id: remove_labels
849829
name: Remove "awaiting-CI"
850830
# we use curl rather than octokit/request-action so that the job won't fail
@@ -854,6 +834,17 @@ jobs:
854834
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.PR.outputs.number }}/labels/awaiting-CI \
855835
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
856836
837+
- if: contains(steps.PR.outputs.pr_labels, 'auto-merge-after-CI')
838+
name: Generate auto merge app token
839+
id: auto-merge-app-token
840+
uses: leanprover-community/mathlib-ci/.github/actions/azure-create-github-app-token@3bb576208589a435eeaeac9b144a1b7c3e948760
841+
with:
842+
app-id: ${{ secrets.MATHLIB_AUTO_MERGE_APP_ID }}
843+
key-vault-name: ${{ vars.MATHLIB_AZ_KEY_VAULT_NAME }}
844+
key-name: mathlib-auto-merge-app-pk
845+
azure-client-id: ${{ vars.GH_APP_AZURE_CLIENT_ID_CI_AUTO_MERGE }}
846+
azure-tenant-id: ${{ secrets.LPC_AZ_TENANT_ID }}
847+
857848
- if: contains(steps.PR.outputs.pr_labels, 'auto-merge-after-CI')
858849
name: Get PR label timeline data
859850
# 'auto-merge-after-CI' must be within the last 100 labels added (could be increased to 250 if needed)

.github/workflows/commit_verification.yml

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# - Transient commits (prefix: "transient: ") must have zero net effect
55
# - Automated commits (prefix: "x: <command>") must match command output
6-
# - Posts a summary comment categorizing commits for reviewers
6+
# - Uploads a workflow artifact with verification status and a comment to be posted on the PR
77

88
name: Commit Verification
99

@@ -18,7 +18,6 @@ concurrency:
1818

1919
permissions:
2020
contents: read
21-
pull-requests: write
2221

2322
env:
2423
TRANSIENT_PREFIX: "transient: "
@@ -67,6 +66,7 @@ jobs:
6766
else
6867
echo "has_special=false" >> "$GITHUB_OUTPUT"
6968
echo "No transient or automated commits found"
69+
echo "No transient or automated commits found; this comment should never be posted" > comment_body.md
7070
fi
7171
7272
- name: Verify commits
@@ -100,26 +100,22 @@ jobs:
100100
# Save to file (GitHub Actions has issues with multiline outputs)
101101
echo "$COMMENT" > comment_body.md
102102
103-
- name: Find existing comment
104-
if: steps.check.outputs.has_special == 'true'
105-
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4
106-
id: find-comment
107-
with:
108-
issue-number: ${{ github.event.pull_request.number }}
109-
comment-author: 'github-actions[bot]'
110-
body-includes: 'Commit Verification Summary'
111-
112-
- name: Post or update comment
113-
if: steps.check.outputs.has_special == 'true'
114-
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v4
115-
with:
116-
comment-id: ${{ steps.find-comment.outputs.comment-id }}
117-
issue-number: ${{ github.event.pull_request.number }}
118-
body-path: comment_body.md
119-
edit-mode: replace
120-
121-
- name: Set job status
122-
if: steps.check.outputs.has_special == 'true' && steps.verify.outputs.success == 'false'
103+
- name: Prepare bridge outputs
123104
run: |
124-
echo "::error::Commit verification failed. See PR comment for details."
125-
exit 1
105+
jq -n \
106+
--arg has_special "${{ steps.check.outputs.has_special }}" \
107+
--arg success "${{ steps.verify.outputs.success }}" \
108+
'{
109+
has_special: $has_special,
110+
success: $success,
111+
}' > bridge-outputs.json
112+
113+
- name: Emit bridge artifact
114+
uses: leanprover-community/privilege-escalation-bridge/emit@d3bd99c50a4cf8c5350a211e8e3ba07ac19067d8 # v1.1.0
115+
with:
116+
artifact: workflow-data
117+
outputs_file: bridge-outputs.json
118+
include_event: minimal
119+
files: |
120+
comment_body.md
121+
retention_days: 5
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Commit Verification CI (workflow run)
2+
# Verifies transient and automated commits in PRs
3+
#
4+
# - Downloads the workflow artifact uploaded by commit_verification.yml
5+
# - Posts a summary comment categorizing commits for reviewers
6+
7+
name: Commit Verification (workflow_run)
8+
9+
on:
10+
workflow_run:
11+
workflows: ["Commit Verification"]
12+
types:
13+
- completed
14+
15+
permissions:
16+
actions: read
17+
contents: read
18+
pull-requests: write
19+
20+
jobs:
21+
verify:
22+
name: Verify Transient and Automated Commits
23+
runs-on: ubuntu-latest
24+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
25+
steps:
26+
- name: Consume bridge artifact
27+
id: bridge
28+
uses: leanprover-community/privilege-escalation-bridge/consume@d3bd99c50a4cf8c5350a211e8e3ba07ac19067d8 # v1.1.0
29+
with:
30+
token: ${{ github.token }}
31+
artifact: workflow-data
32+
source_workflow: Commit Verification
33+
require_event: pull_request
34+
fail_on_missing: false
35+
extract: |
36+
pr_number=meta.pr_number
37+
has_special=outputs.has_special
38+
success=outputs.success
39+
40+
- name: Find existing comment
41+
if: steps.bridge.outputs.has_special == 'true'
42+
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4
43+
id: find-comment
44+
with:
45+
issue-number: ${{ steps.bridge.outputs.pr_number }}
46+
comment-author: 'github-actions[bot]'
47+
body-includes: 'Commit Verification Summary'
48+
49+
- name: Post or update comment
50+
if: steps.bridge.outputs.has_special == 'true'
51+
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v4
52+
with:
53+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
54+
issue-number: ${{ steps.bridge.outputs.pr_number }}
55+
body-path: .bridge/comment_body.md
56+
edit-mode: replace
57+
58+
- name: Set job status
59+
if: steps.bridge.outputs.has_special == 'true' && steps.bridge.outputs.success == 'false'
60+
run: |
61+
echo "::error::Commit verification failed. See PR comment for details."
62+
exit 1

.github/workflows/maintainer_bors_wf_run.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,21 @@ jobs:
6969
- name: Select bridge or legacy inputs
7070
id: inputs
7171
if: ${{ steps.bridge.outputs.pr_number != '' || steps.legacy.outputs.pr_number != '' }}
72+
env:
73+
INPUT_AUTHOR: ${{ steps.bridge.outputs.author }}${{ steps.legacy.outputs.author }}
74+
INPUT_PR_NUMBER: ${{ steps.bridge.outputs.pr_number }}${{ steps.legacy.outputs.pr_number }}
75+
INPUT_BOT: ${{ steps.bridge.outputs.bot }}${{ steps.legacy.outputs.bot }}
76+
INPUT_REMOVE_LABELS: ${{ steps.bridge.outputs.removeLabels }}${{ steps.legacy.outputs.removeLabels }}
77+
INPUT_MORD: ${{ steps.bridge.outputs.mOrD }}${{ steps.legacy.outputs.mOrD }}
78+
INPUT_SOURCE: ${{ steps.bridge.outputs.pr_number != '' && 'bridge' || (steps.legacy.outputs.pr_number != '' && 'legacy' || 'none') }}
7279
run: |
7380
{
74-
echo "author=${{ steps.bridge.outputs.author }}${{ steps.legacy.outputs.author }}"
75-
echo "pr_number=${{ steps.bridge.outputs.pr_number }}${{ steps.legacy.outputs.pr_number }}"
76-
echo "bot=${{ steps.bridge.outputs.bot }}${{ steps.legacy.outputs.bot }}"
77-
echo "removeLabels=${{ steps.bridge.outputs.removeLabels }}${{ steps.legacy.outputs.removeLabels }}"
78-
echo "mOrD=${{ steps.bridge.outputs.mOrD }}${{ steps.legacy.outputs.mOrD }}"
79-
echo "input_source=${{ steps.bridge.outputs.pr_number != '' && 'bridge' || (steps.legacy.outputs.pr_number != '' && 'legacy' || 'none') }}"
81+
echo "author=${INPUT_AUTHOR}"
82+
echo "pr_number=${INPUT_PR_NUMBER}"
83+
echo "bot=${INPUT_BOT}"
84+
echo "removeLabels=${INPUT_REMOVE_LABELS}"
85+
echo "mOrD=${INPUT_MORD}"
86+
echo "input_source=${INPUT_SOURCE}"
8087
} | tee -a "$GITHUB_OUTPUT"
8188
8289
- name: Note legacy artifact fallback
@@ -182,6 +189,7 @@ jobs:
182189
if: ${{ ! steps.inputs.outputs.mOrD == '' &&
183190
( steps.user_permission.outputs.require-result == 'true' ||
184191
steps.inputs.outputs.bot == 'true' ) }}
192+
continue-on-error: true
185193
env:
186194
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
187195
ZULIP_EMAIL: github-mathlib4-bot@leanprover.zulipchat.com

.github/workflows/maintainer_merge_wf_run.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,28 @@ jobs:
7373
- name: Select bridge or legacy inputs
7474
id: inputs
7575
if: ${{ steps.bridge.outputs.pr_number != '' || steps.legacy.outputs.pr_number != '' }}
76+
env:
77+
INPUT_AUTHOR: ${{ steps.bridge.outputs.author }}${{ steps.legacy.outputs.author }}
78+
INPUT_PR_AUTHOR: ${{ steps.bridge.outputs.pr_author }}${{ steps.legacy.outputs.pr_author }}
79+
INPUT_PR_NUMBER: ${{ steps.bridge.outputs.pr_number }}${{ steps.legacy.outputs.pr_number }}
80+
INPUT_PR_TITLE: ${{ steps.bridge.outputs.pr_title }}${{ steps.legacy.outputs.pr_title }}
81+
INPUT_PR_URL: ${{ steps.bridge.outputs.pr_url }}${{ steps.legacy.outputs.pr_url }}
82+
INPUT_EVENT_NAME: ${{ steps.bridge.outputs.event_name }}${{ steps.legacy.outputs.event_name }}
83+
INPUT_MORD: ${{ steps.bridge.outputs.mOrD }}${{ steps.legacy.outputs.mOrD }}
84+
INPUT_SOURCE: ${{ steps.bridge.outputs.pr_number != '' && 'bridge' || (steps.legacy.outputs.pr_number != '' && 'legacy' || 'none') }}
85+
INPUT_COMMENT: ${{ steps.bridge.outputs.comment }}${{ steps.legacy.outputs.comment }}
7686
run: |
7787
{
78-
echo "author=${{ steps.bridge.outputs.author }}${{ steps.legacy.outputs.author }}"
79-
echo "pr_author=${{ steps.bridge.outputs.pr_author }}${{ steps.legacy.outputs.pr_author }}"
80-
echo "pr_number=${{ steps.bridge.outputs.pr_number }}${{ steps.legacy.outputs.pr_number }}"
81-
echo "pr_title=${{ steps.bridge.outputs.pr_title }}${{ steps.legacy.outputs.pr_title }}"
82-
echo "pr_url=${{ steps.bridge.outputs.pr_url }}${{ steps.legacy.outputs.pr_url }}"
83-
echo "event_name=${{ steps.bridge.outputs.event_name }}${{ steps.legacy.outputs.event_name }}"
84-
echo "mOrD=${{ steps.bridge.outputs.mOrD }}${{ steps.legacy.outputs.mOrD }}"
85-
echo "input_source=${{ steps.bridge.outputs.pr_number != '' && 'bridge' || (steps.legacy.outputs.pr_number != '' && 'legacy' || 'none') }}"
88+
echo "author=${INPUT_AUTHOR}"
89+
echo "pr_author=${INPUT_PR_AUTHOR}"
90+
echo "pr_number=${INPUT_PR_NUMBER}"
91+
echo "pr_title=${INPUT_PR_TITLE}"
92+
echo "pr_url=${INPUT_PR_URL}"
93+
echo "event_name=${INPUT_EVENT_NAME}"
94+
echo "mOrD=${INPUT_MORD}"
95+
echo "input_source=${INPUT_SOURCE}"
8696
} | tee -a "$GITHUB_OUTPUT"
87-
printf 'comment<<EOF\n%s\nEOF\n' "${{ steps.bridge.outputs.comment }}${{ steps.legacy.outputs.comment }}" | tee -a "$GITHUB_OUTPUT"
97+
printf 'comment<<EOF\n%s\nEOF\n' "${INPUT_COMMENT}" | tee -a "$GITHUB_OUTPUT"
8898
8999
- name: Note legacy artifact fallback
90100
if: ${{ steps.inputs.outputs.input_source == 'legacy' }}
@@ -139,7 +149,7 @@ jobs:
139149
then
140150
legacy_suffix=" (legacy)"
141151
fi
142-
metadata=$'trigger_name: ['"${trigger_name}"$']('"${trigger_run_url}"$')\nwf_run: [workflow_run]('"${wf_run_url}"$')'"${legacy_suffix}"
152+
metadata=$'['"${trigger_name}"$']('"${trigger_run_url}"$'), [wf_run]('"${wf_run_url}"$')'"${legacy_suffix}"
143153
message="${message}"$'\n\n---\n'"${metadata}"
144154
printf 'title<<EOF\n%s\nEOF' "${message}" | tee "$GITHUB_OUTPUT"
145155
env:
@@ -153,6 +163,7 @@ jobs:
153163

154164
- name: Send message on Zulip
155165
if: ${{ steps.actorTeams.outputs.isTeamMember == 'true' }}
166+
continue-on-error: true
156167
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
157168
with:
158169
api-key: ${{ secrets.ZULIP_API_KEY }}
@@ -176,12 +187,13 @@ jobs:
176187
then
177188
legacy_suffix=" (legacy)"
178189
fi
179-
metadata=$'trigger_name: ['"${trigger_name}"$']('"${trigger_run_url}"$')\nwf_run: [workflow_run]('"${wf_run_url}"$')'"${legacy_suffix}"
190+
metadata=$'['"${trigger_name}"$']('"${trigger_run_url}"$'), [wf_run]('"${wf_run_url}"$')'"${legacy_suffix}"
180191
body="${body}"$'\n\n---\n'"${metadata}"
181192
printf 'body<<EOF\n%s\nEOF\n' "${body}" | tee -a "$GITHUB_OUTPUT"
182193
183194
- name: Add comment to PR
184195
if: ${{ steps.actorTeams.outputs.isTeamMember == 'true' }}
196+
continue-on-error: true
185197
uses: GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1
186198
with:
187199
# if a comment triggers the action, then `issue.number` is set
@@ -202,6 +214,7 @@ jobs:
202214

203215
- name: Add label to PR
204216
if: ${{ steps.actorTeams.outputs.isTeamMember == 'true' }}
217+
continue-on-error: true
205218
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
206219
with:
207220
# labels added by GITHUB_TOKEN won't trigger the Zulip emoji workflow

.github/workflows/nightly_bump_and_merge.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,13 @@ jobs:
337337
IFS='|' read -r PR_NUMBER GITHUB_DIFF _ <<< "$MERGE_INFO"
338338
MESSAGE+="- [lean-pr-testing-${PR_NUMBER}](${GITHUB_DIFF}) (adaptations for lean#${PR_NUMBER})"$'\n\n'
339339
MESSAGE+=$'```bash\n'
340-
MESSAGE+=$'tmp=$(mktemp)\n'
341-
MESSAGE+=$'wget -qO "$tmp" https://raw.githubusercontent.com/leanprover-community/mathlib-ci/${{ steps.get_mathlib_ci.outputs.ref }}/scripts/nightly/merge-lean-testing-pr.sh\n'
342-
MESSAGE+=$'chmod +x "$tmp"\n'
343-
MESSAGE+="\"\$tmp\" ${PR_NUMBER}"$'\n'
340+
MESSAGE+=$'tmpscript=$(mktemp)\n'
341+
MESSAGE+=$'wget -qO "$tmpscript" https://raw.githubusercontent.com/leanprover-community/mathlib-ci/${{ steps.get_mathlib_ci.outputs.ref }}/scripts/nightly/merge-lean-testing-pr.sh\n'
342+
MESSAGE+=$'chmod +x "$tmpscript"\n'
343+
MESSAGE+=$'tmpdir=$(mktemp -d)\n'
344+
MESSAGE+=$'git clone --depth=1 --filter=blob:none https://github.com/leanprover-community/mathlib4 "$tmpdir"\n'
345+
MESSAGE+=$'cd "$tmpdir"\n'
346+
MESSAGE+="\"\$tmpscript\" ${PR_NUMBER}"$'\n'
344347
MESSAGE+=$'```\n\n'
345348
done
346349
else

.github/workflows/nightly_detect_failure.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ jobs:
431431
bump_branch_suffix = bump_branch.replace('bump/', '')
432432
failed_link = f"https://github.com/{repository}/actions/runs/{current_run_id}"
433433
payload = f"🛠️: Automatic PR creation [failed]({failed_link}). Please create a new bump/nightly-{current_version} branch from nightly-testing (specifically {sha}), and then PR that to {bump_branch}. "
434-
payload += "To do so semi-automatically from a mathlib checkout, run:\n\n"
435-
payload += f"```bash\ntmp=$(mktemp)\nwget -qO \"$tmp\" https://raw.githubusercontent.com/leanprover-community/mathlib-ci/${{ steps.get_mathlib_ci.outputs.ref }}/scripts/nightly/create-adaptation-pr.sh\nchmod +x \"$tmp\"\n\"$tmp\" --bumpversion={bump_branch_suffix} --nightlydate={current_version} --nightlysha={sha}\n```\n"
434+
payload += "To do so semi-automatically, run:\n\n"
435+
payload += f"```bash\ntmpscript=$(mktemp)\nwget -qO \"$tmpscript\" https://raw.githubusercontent.com/leanprover-community/mathlib-ci/${{ steps.get_mathlib_ci.outputs.ref }}/scripts/nightly/create-adaptation-pr.sh\nchmod +x \"$tmpscript\"\ntmpdir=$(mktemp -d)\ngit clone --filter=blob:none https://github.com/leanprover-community/mathlib4 \"$tmpdir\"\ncd \"$tmpdir\"\n\"$tmpscript\" --bumpversion={bump_branch_suffix} --nightlydate={current_version} --nightlysha={sha}\n```\n"
436436
# Check if we already posted a message for this nightly date and bump branch.
437437
# We extract these fields from the last bot message rather than comparing substrings,
438438
# since the message also contains a run ID that differs between workflow runs.

.github/workflows/zulip_emoji_ci_status.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
9999
- name: Update CI emoji
100100
if: steps.pr.outputs.skip != 'true' && steps.action.outputs.ci_action != 'skip'
101+
continue-on-error: true
101102
env:
102103
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
103104
ZULIP_EMAIL: github-mathlib4-bot@leanprover.zulipchat.com

.github/workflows/zulip_emoji_closed_pr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
- name: Update zulip emoji reactions
6262
if: ${{ ! startsWith(github.event.pull_request.title, '[Merged by Bors]') ||
6363
github.event_name == 'reopened' }}
64+
continue-on-error: true
6465
env:
6566
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
6667
ZULIP_EMAIL: github-mathlib4-bot@leanprover.zulipchat.com

.github/workflows/zulip_emoji_labelling.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
pip install -r "$CI_SCRIPTS_DIR/zulip/requirements.txt"
3838
3939
- name: Add or remove emoji
40+
continue-on-error: true # Emoji updates are cosmetic; never fail CI over them
4041
env:
4142
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
4243
ZULIP_EMAIL: github-mathlib4-bot@leanprover.zulipchat.com

0 commit comments

Comments
 (0)