-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bot validates lean-toolchain on bump/v4.X.0 branches (#20478)
- Loading branch information
Showing
1 changed file
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,15 +170,40 @@ jobs: | |
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const response = await github.rest.repos.getContent({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
path: 'lean-toolchain', | ||
ref: ${{ steps.latest_bump_branch.outputs.result }} | ||
}); | ||
const content = Buffer.from(response.data.content, 'base64').toString(); | ||
const version = content.match(/leanprover\/lean4:nightly-(\d{4}-\d{2}-\d{2})/)[1]; | ||
return version; | ||
try { | ||
const response = await github.rest.repos.getContent({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
path: 'lean-toolchain', | ||
ref: ${{ steps.latest_bump_branch.outputs.result }} | ||
}); | ||
const content = Buffer.from(response.data.content, 'base64').toString(); | ||
const match = content.match(/leanprover\/lean4:nightly-(\d{4}-\d{2}-\d{2})/); | ||
if (!match) { | ||
core.setFailed('Toolchain pattern did not match'); | ||
core.setOutput('toolchain_content', content); | ||
return null; | ||
} | ||
return match[1]; | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
return null; | ||
} | ||
- name: Send warning message on Zulip if pattern doesn't match | ||
if: failure() | ||
uses: zulip/github-actions-zulip/send-message@v1 | ||
with: | ||
api-key: ${{ secrets.ZULIP_API_KEY }} | ||
email: '[email protected]' | ||
organization-url: 'https://leanprover.zulipchat.com' | ||
to: 'nightly-testing' | ||
type: 'stream' | ||
topic: 'Mathlib status updates' | ||
content: | | ||
⚠️ Warning: The lean-toolchain file in the latest bump branch does not match the expected pattern 'leanprover/lean4:nightly-YYYY-MM-DD'. | ||
Current content: ${{ steps.bump_version.outputs.toolchain_content }} | ||
This needs to be fixed for the nightly testing process to work correctly. | ||
- name: Compare versions and post a reminder. | ||
env: | ||
|