Spracherkennung für: .yaml vermutete Sprache: SQL {SQL[56] Python[38] R[38]} [Methode: maximale Elemente, drei Dimensionen]
name: shake
on:
schedule:
# Run several hours
before the technical debt report which runs Mondays at
04:
00 UTC
- cron:
"10 20 * * 0" # At
20:
10 UTC
on Sunday.
workflow_dispatch:
inputs:
dry_run:
description:
'If true, only scan and report without modifying files or opening a PR'
required:
false
default:
false
type: boolean
# auto_merge:
# description:
'If true, apply the auto-merge-after-CI label when creating a PR'
# required:
false
#
default:
true
# type: boolean
jobs:
build:
name: lake shake
--fix
runs-
on: ubuntu-latest
if: github.repository ==
'leanprover-community/mathlib4'
permissions:
contents:
read
id-token:
write
steps:
- uses: actions/checkout@
3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.
0.
1
- name: Configure Lean
uses: leanprover/lean-action@fe408643ea7367d8c0404a8be3975bb145f5fb64 # v1.
7.
0
with:
auto-config:
false
use-github-cache:
false
use-mathlib-cache:
true
# - name: lake build
# run: |
# lake build Archive Counterexamples
- name: lake shake
id: shake
run: |
#
Add back Archive
and Counterexamples
when they
've been modulized
lake shake --add-public --keep-implied --keep-prefix --add-public-downstream Mathlib.Init --fix --explain Mathlib > explain.txt 2>&1
if git diff --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Parse shake stats
id: stats
if: steps.shake.outputs.changed == 'true'
run: |
scripts/parse_shake_output.py explain.txt "$GITHUB_OUTPUT"
- name: Upload explain.txt
id: upload-artifact
if: failure() || steps.shake.outputs.changed == 'true'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: shake-explain
path: explain.txt
- name: Cleanup explain.txt
if: steps.shake.outputs.changed == 'true'
run: |
rm -f explain.txt
- name: Build PR body
id: pr_body
if: steps.shake.outputs.changed == 'true' && toJson(inputs.dry_run) != 'true'
shell: bash
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
ARTIFACT_ID: ${{ steps.upload-artifact.outputs.artifact-id }}
CHANGED_FILES: ${{ steps.stats.outputs.changed_files }}
ADDED: ${{ steps.stats.outputs.added }}
REMOVED: ${{ steps.stats.outputs.removed }}
run: |
{
echo "body<<EOF"
echo "I am happy to shake some imports for you!"
echo ""
echo "**${CHANGED_FILES} files changed** · +${ADDED} imports added · -${REMOVED} imports removed"
echo ""
echo "---"
echo ""
echo "[workflow run for this PR](${RUN_URL})"
echo "[explain.txt](${RUN_URL}/artifacts/${ARTIFACT_ID})"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Generate app token
id: app-token
if: steps.shake.outputs.changed == 'true' && toJson(inputs.dry_run) != 'true'
uses: leanprover-community/mathlib-ci/.github/actions/azure-create-github-app-token@d6393a535c054122e507b6c5e1b2f4c31c604121
with:
app-id: ${{ secrets.MATHLIB_NOLINTS_APP_ID }}
key-vault-name: ${{ vars.MATHLIB_AZ_KEY_VAULT_NAME }}
key-name: mathlib-nolints-app-pk
azure-client-id: ${{ vars.GH_APP_AZURE_CLIENT_ID_PR_WRITERS }}
azure-tenant-id: ${{ secrets.LPC_AZ_TENANT_ID }}
- name: Create Pull Request
id: pr
if: steps.shake.outputs.changed == 'true' && toJson(inputs.dry_run) != 'true'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
author: "mathlib-nolints[bot] <258989889+mathlib-nolints[bot]@users.noreply.github.com>"
token: "${{ steps.app-token.outputs.token }}"
commit-message: |
chore: lake shake --add-public --keep-implied --keep-prefix --add-public-downstream Mathlib.Init --fix
${{ steps.stats.outputs.changed_files }} files changed · +${{ steps.stats.outputs.added }} imports added · -${{ steps.stats.outputs.removed }} imports removed
branch: "shake"
base: master
title: "chore: lake shake --add-public --keep-implied --keep-prefix --add-public-downstream Mathlib.Init --fix"
body: ${{ steps.pr_body.outputs.body }}
# labels: ${{ (github.event_name == 'schedule
' || toJson(inputs.auto_merge) == 'true') && 'au
to-merge-after-CI' || '' }}
- name: Send Zulip message (success)
if: steps.pr.outcome == 'success'
uses: zulip/github-actions-zulip/send-message@f675f2b4eb2a95fae974215476dcb7ad8dfeff6b # v2.0.2
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
organization-url: 'https://leanprover.zulipchat.com'
to: 'nightly-testing-mathlib'
type: 'stream'
topic: 'Mathlib `shake --fix`'
content: |
Please review #${{ steps.pr.outputs.pull-request-number }} which changes
${{ steps.stats.outputs.changed_files }} files:
- +${{ steps.stats.outputs.added }} imports added
- -${{ steps.stats.outputs.removed }} imports removed
- name: Send Zulip message (failure)
if: ${{ toJson(inputs.dry_run) != 'true' && failure() }}
uses: zulip/github-actions-zulip/send-message@f675f2b4eb2a95fae974215476dcb7ad8dfeff6b # v2.0.2
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
organization-url: 'https://leanprover.zulipchat.com'
to: 'nightly-testing-mathlib'
type: 'stream'
topic: 'Mathlib `shake --fix`'
content: |
[`shake` workflow run failed](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
triggered by: `${{ github.event_name }}`
[Dauer der Verarbeitung: 0.3 Sekunden, vorverarbeitet 2026-11-18]