Skip to content

Commit 57a2811

Browse files
Merge branch 'master' into Frullani_integral
2 parents 0570c4e + 5b38ccd commit 57a2811

85 files changed

Lines changed: 3218 additions & 1650 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/bors.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- staging
7+
- trying
78

89
concurrency:
910
# label each workflow run; only the latest with each label will run
@@ -25,5 +26,6 @@ jobs:
2526
concurrency_group: ${{ github.workflow }}-${{ github.ref }}-${{ github.run_id }}
2627
pr_branch_ref: ${{ github.sha }}
2728
job_name_suffix: ""
28-
runs_on: bors
29+
# We don't wan't 'bors try' runs to compete with merge-candidates, so we pool trying with PR runs
30+
runs_on: ${{ github.ref_name == 'trying' && 'pr' || 'bors' }}
2931
secrets: inherit

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ on:
77
- 'staging.tmp*'
88
- 'trying.tmp*'
99
- 'staging*.tmp'
10-
# ignore staging branch used by bors, this is handled by bors.yml
10+
# ignore staging and trying branches used by bors, these are handled by bors.yml
1111
- 'staging'
12+
- 'trying'
1213
merge_group:
1314

1415
concurrency:

.github/workflows/build_fork.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
- 'trying.tmp*'
99
- 'staging*.tmp'
1010
- 'nolints'
11+
paths-ignore:
12+
# pull_request_target uses the workflow from the target branch:
13+
# PR changes under this directory won't affect this run, so
14+
# running it is just wasteful
15+
- '.github/workflows/**'
1116

1217
concurrency:
1318
# label each workflow run; only the latest with each label will run

.github/workflows/build_template.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,13 @@ jobs:
692692
needs: [style_lint, build, post_steps]
693693
runs-on: ubuntu-latest
694694
steps:
695+
- name: Generate auto merge app token
696+
id: auto-merge-app-token
697+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
698+
with:
699+
app-id: ${{ secrets.MATHLIB_AUTO_MERGE_APP_ID }}
700+
private-key: ${{ secrets.MATHLIB_AUTO_MERGE_PRIVATE_KEY }}
701+
695702
- id: PR_from_push
696703
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
697704
# TODO: this may not work properly if the same commit is pushed to multiple branches:
@@ -788,11 +795,12 @@ jobs:
788795
username: ${{ steps.get-label-actor.outputs.username }}
789796
GITHUB_TOKEN: ${{ secrets.MATHLIB_REVIEWERS_TEAM_KEY }} # (Requires scope: `read:org`)
790797

798+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
791799
- if: ${{ contains(steps.PR.outputs.pr_labels, 'auto-merge-after-CI') && (contains(steps.actorTeams.outputs.teams, 'mathlib-maintainers') || contains(steps.actorTeams.outputs.teams, 'bot-users')) }}
792800
name: If `auto-merge-after-CI` is present, add a `bors merge` comment.
793801
uses: GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1
794802
with:
795-
token: ${{ secrets.AUTO_MERGE_TOKEN }}
803+
token: ${{ steps.auto-merge-app-token.outputs.token }}
796804
issue-number: ${{ steps.PR.outputs.number }}
797805
body: |
798806
As this PR is labelled `auto-merge-after-CI`, we are now sending it to bors:

.github/workflows/maintainer_bors.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,19 @@ jobs:
2323
COMMENT_REVIEW: ${{ github.event.review.body }}
2424
PR_NUMBER: ${{ github.event.issue.number }}${{ github.event.pull_request.number }}
2525
HAS_DELEGATED_LABEL: ${{ contains(github.event.issue.labels.*.name, 'delegated') }}
26+
HAS_TRIAGE_SECRET: ${{ secrets.MATHLIB_TRIAGE_APP_ID != '' }}
2627
name: Add ready-to-merge or delegated label
2728
runs-on: ubuntu-latest
2829
if: github.repository == 'leanprover-community/mathlib4'
2930
steps:
31+
- name: Generate app token
32+
if: ${{ env.HAS_TRIAGE_SECRET == 'true' }}
33+
id: app-token
34+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
35+
with:
36+
app-id: ${{ secrets.MATHLIB_TRIAGE_APP_ID }}
37+
private-key: ${{ secrets.MATHLIB_TRIAGE_PRIVATE_KEY }}
38+
3039
- name: Find bors merge/delegate
3140
id: merge_or_delegate
3241
run: |
@@ -58,7 +67,8 @@ jobs:
5867
printf $'removeLabels=%s\n' "${remove_labels}" >> "${GITHUB_OUTPUT}"
5968
if [ "${AUTHOR}" == 'leanprover-community-mathlib4-bot' ] ||
6069
[ "${AUTHOR}" == 'leanprover-community-bot-assistant' ] ||
61-
[ "${AUTHOR}" == 'mathlib-bors[bot]' ]
70+
[ "${AUTHOR}" == 'mathlib-bors[bot]' ] ||
71+
[ "${AUTHOR}" == 'mathlib-triage[bot]' ]
6272
then
6373
printf $'bot=true\n'
6474
printf $'bot=true\n' >> "${GITHUB_OUTPUT}"
@@ -70,7 +80,7 @@ jobs:
7080
fi
7181
7282
# write an artifact with all data needed below if we don't have access to necessary secrets
73-
if [[ -z '${{ secrets.TRIAGE_TOKEN }}' ]]
83+
if [[ -z '${{ secrets.MATHLIB_TRIAGE_APP_ID }}' ]]
7484
then
7585
printf 'No access to secrets, writing to file.\n'
7686
jq -n \
@@ -131,7 +141,8 @@ jobs:
131141
issue_number: ${{ github.event.issue.number }}${{ github.event.pull_request.number }}
132142
labels: '["${{ steps.merge_or_delegate.outputs.mOrD }}"]'
133143
env:
134-
GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }}
144+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
145+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
135146

136147
- if: ${{ ! steps.merge_or_delegate.outputs.secrets == '' &&
137148
(! steps.merge_or_delegate.outputs.mOrD == '' &&
@@ -145,7 +156,7 @@ jobs:
145156
for label in awaiting-author maintainer-merge; do
146157
curl --request DELETE \
147158
--url "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}${{ github.event.pull_request.number }}/labels/${label}" \
148-
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
159+
--header 'authorization: Bearer ${{ steps.app-token.outputs.token }}'
149160
done
150161
151162
- name: On bors r/d-, remove ready-to-merge or delegated label
@@ -158,7 +169,7 @@ jobs:
158169
for label in ready-to-merge delegated; do
159170
curl --request DELETE \
160171
--url "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}${{ github.event.pull_request.number }}/labels/${label}" \
161-
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
172+
--header 'authorization: Bearer ${{ steps.app-token.outputs.token }}'
162173
done
163174
164175
- name: Set up Python

.github/workflows/maintainer_bors_wf_run.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ jobs:
1313
runs-on: ubuntu-latest
1414
if: ${{ github.repository == 'leanprover-community/mathlib4' && github.event.workflow_run.conclusion == 'success' }}
1515
steps:
16+
- name: Generate app token
17+
id: app-token
18+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
19+
with:
20+
app-id: ${{ secrets.MATHLIB_TRIAGE_APP_ID }}
21+
private-key: ${{ secrets.MATHLIB_TRIAGE_PRIVATE_KEY }}
22+
1623
- name: Download artifact
1724
id: download-artifact
1825
uses: dawidd6/action-download-artifact@5c98f0b039f36ef966fdb7dfa9779262785ecb05 # v14
@@ -80,7 +87,8 @@ jobs:
8087
issue_number: ${{ steps.extract-data.outputs.pr_number }}
8188
labels: '["${{ steps.extract-data.outputs.mOrD }}"]'
8289
env:
83-
GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }}
90+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
91+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
8492

8593
- if: ${{ ! steps.extract-data.outputs.mOrD == '' &&
8694
( steps.user_permission.outputs.require-result == 'true' ||
@@ -93,7 +101,7 @@ jobs:
93101
for label in awaiting-author maintainer-merge; do
94102
curl --request DELETE \
95103
--url "https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-data.outputs.pr_number }}/labels/${label}" \
96-
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
104+
--header 'authorization: Bearer ${{ steps.app-token.outputs.token }}'
97105
done
98106
99107
- name: On bors r/d-, remove ready-to-merge or delegated label
@@ -104,7 +112,7 @@ jobs:
104112
for label in ready-to-merge delegated; do
105113
curl --request DELETE \
106114
--url "https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-data.outputs.pr_number }}/labels/${label}" \
107-
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
115+
--header 'authorization: Bearer ${{ steps.app-token.outputs.token }}'
108116
done
109117
110118
- name: Set up Python

.github/workflows/maintainer_merge.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
PR_TITLE_PR: ${{ github.event.pull_request.title }}
2828
PR_URL: ${{ github.event.issue.html_url }}${{ github.event.pull_request.html_url }}
2929
EVENT_NAME: ${{ github.event_name }}
30+
HAS_TRIAGE_SECRET: ${{ secrets.MATHLIB_TRIAGE_APP_ID != '' }}
3031
name: Ping maintainers on Zulip
3132
runs-on: ubuntu-latest
3233
if: >- # crude check to skip running this on most reviews / comments
@@ -36,6 +37,14 @@ jobs:
3637
contains(format('{0}{1}', github.event.comment.body, github.event.review.body), 'maintainer delegate')
3738
)
3839
steps:
40+
- name: Generate app token
41+
if: ${{ env.HAS_TRIAGE_SECRET == 'true' }}
42+
id: app-token
43+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
44+
with:
45+
app-id: ${{ secrets.MATHLIB_TRIAGE_APP_ID }}
46+
private-key: ${{ secrets.MATHLIB_TRIAGE_PRIVATE_KEY }}
47+
3948
- name: Find maintainer merge/delegate
4049
id: merge_or_delegate
4150
run: |
@@ -58,7 +67,7 @@ jobs:
5867
printf $'mOrD=%s\n' "${m_or_d}" > "${GITHUB_OUTPUT}"
5968
6069
# write an artifact with all data needed below if we don't have access to necessary secrets
61-
if [[ -z '${{ secrets.MATHLIB_REVIEWERS_TEAM_KEY }}' ]]
70+
if [[ -z '${{ secrets.MATHLIB_TRIAGE_APP_ID }}' ]]
6271
then
6372
printf 'No access to secrets, writing to file.\n'
6473
jq -n \
@@ -167,7 +176,8 @@ jobs:
167176
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
168177
with:
169178
# labels added by GITHUB_TOKEN won't trigger the Zulip emoji workflow
170-
github-token: ${{secrets.TRIAGE_TOKEN}}
179+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
180+
github-token: ${{ steps.app-token.outputs.token }}
171181
script: |
172182
const { owner, repo, number: issue_number } = context.issue;
173183
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: ['maintainer-merge'] });

.github/workflows/maintainer_merge_wf_run.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ jobs:
1313
runs-on: ubuntu-latest
1414
if: ${{ github.repository == 'leanprover-community/mathlib4' && github.event.workflow_run.conclusion == 'success' }}
1515
steps:
16+
- name: Generate app token
17+
id: app-token
18+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
19+
with:
20+
app-id: ${{ secrets.MATHLIB_TRIAGE_APP_ID }}
21+
private-key: ${{ secrets.MATHLIB_TRIAGE_PRIVATE_KEY }}
22+
1623
- name: Download artifact
1724
id: download-artifact
1825
uses: dawidd6/action-download-artifact@5c98f0b039f36ef966fdb7dfa9779262785ecb05 # v14
@@ -140,7 +147,8 @@ jobs:
140147
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
141148
with:
142149
# labels added by GITHUB_TOKEN won't trigger the Zulip emoji workflow
143-
github-token: ${{secrets.TRIAGE_TOKEN}}
150+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
151+
github-token: ${{ steps.app-token.outputs.token }}
144152
script: |
145153
const { owner, repo } = context.repo;
146154
const issue_number = ${{ steps.extract-data.outputs.pr_number }};

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ on:
88
- 'trying.tmp*'
99
- 'staging*.tmp'
1010
- 'nolints'
11-
# ignore staging branch used by bors, this is handled by bors.yml
11+
# ignore staging and trying branches used by bors, these are handled by bors.yml
1212
- 'staging'
13+
- 'trying'
1314
- 'master'
1415
pull_request:
1516

.github/workflows/update_dependencies.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ jobs:
1212
env:
1313
BRANCH_NAME: "update-dependencies-bot-use-only"
1414
steps:
15+
- name: Generate app token
16+
id: app-token
17+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
18+
with:
19+
app-id: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_APP_ID }}
20+
private-key: ${{ secrets.MATHLIB_UPDATE_DEPENDENCIES_PRIVATE_KEY }}
21+
22+
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
1523
- name: Checkout repository
1624
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1725
with:
1826
fetch-depth: 0
19-
token: "${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}"
27+
token: ${{ steps.app-token.outputs.token }}
2028

2129
- name: Configure Lean
2230
uses: leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4.0
@@ -116,8 +124,7 @@ jobs:
116124
if: ${{ steps.pr-title.outcome == 'success' }}
117125
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
118126
with:
119-
token: "${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}"
120-
author: "leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com>"
127+
token: ${{ steps.app-token.outputs.token }}
121128
commit-message: "chore: update Mathlib dependencies ${{ env.timestamp }}"
122129
# this branch is referenced in update_dependencies_zulip.yml
123130
branch: ${{ env.BRANCH_NAME }}

0 commit comments

Comments
 (0)