@@ -127,6 +127,9 @@ jobs:
127127 ref : ${{ inputs.pr_branch_ref }}
128128 fetch-depth : 2 # we may fetch cache from the commit before this one (or earlier)
129129 path : pr-branch
130+ # This is an untrusted (potentially fork) checkout whose code we build.
131+ # Don't leave the GITHUB_TOKEN in pr-branch/.git/config, where that code could read it.
132+ persist-credentials : false
130133
131134 - name : Prepare DownstreamTest directory
132135 shell : bash
@@ -222,7 +225,7 @@ jobs:
222225
223226 - name : validate lake-manifest.json inputRevs
224227 # Only enforce this on the main mathlib4 repository, not on nightly-testing
225- if : github.repository == 'leanprover-community/mathlib4'
228+ if : github.repository == 'leanprover-community/mathlib4' && github.ref_name != 'nightly-testing'
226229 shell : bash
227230 run : |
228231 cd pr-branch
@@ -451,7 +454,7 @@ jobs:
451454
452455 - name : upload cache staging artifact
453456 if : ${{ always() && steps.cache_staging_check.outputs.has_files == 'true' }}
454- uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
457+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
455458 with :
456459 name : cache-staging
457460 path : cache-staging/
@@ -513,19 +516,19 @@ jobs:
513516 run : |
514517 cd pr-branch
515518 set -o pipefail
516- # Try running with --trace; if it fails due to argument parsing, the PR needs to merge master
519+ # If lint fails because the PR predates lake-lint configuration or the
520+ # old --trace argument-parsing behavior, ask the author to merge master.
517521 # We use .lake/ for the output file because landrun restricts /tmp access
518522 for attempt in 1 2; do
519- if timeout 10m env LEAN_ABORT_ON_PANIC=1 stdbuf -oL lake exe runLinter --trace Mathlib 2>&1 | tee ".lake/lint_output_attempt_${attempt}.txt"; then
523+ if timeout 10m env LEAN_ABORT_ON_PANIC=1 stdbuf -oL lake lint -- --trace 2>&1 | tee ".lake/lint_output_attempt_${attempt}.txt"; then
520524 break
521525 fi
522526 status=${PIPESTATUS[0]}
523- if grep -q "cannot parse arguments" ".lake/lint_output_attempt_${attempt}.txt"; then
527+ if grep -qE "cannot parse arguments|no lint driver configured " ".lake/lint_output_attempt_${attempt}.txt"; then
524528 echo ""
525529 echo "=============================================================================="
526- echo "ERROR: Your branch uses an older version of runLinter that doesn't support"
527- echo "the --trace flag. Please merge 'master' into your PR branch to get the"
528- echo "updated linter, then push again."
530+ echo "ERROR: Your branch predates the current 'lake lint' configuration."
531+ echo "Please merge 'master' into your PR branch and push again."
529532 echo ""
530533 echo "You can do this with:"
531534 echo " git fetch upstream"
@@ -574,12 +577,14 @@ jobs:
574577 - name : Generate lean-pr-testing app token
575578 if : ${{ always() && github.repository == 'leanprover-community/mathlib4-nightly-testing' && (startsWith(github.ref_name, 'lean-pr-testing-') || startsWith(github.ref_name, 'batteries-pr-testing-')) }}
576579 id : lean-pr-testing-token
577- uses : actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
580+ uses : actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
578581 with :
579- app-id : ${{ secrets.MATHLIB_LEAN_PR_TESTING_APP_ID }}
580- private-key : ${{ secrets.MATHLIB_LEAN_PR_TESTING_PRIVATE_KEY }}
581- owner : leanprover
582- repositories : lean4
582+ # `batteries-pr-testing-*` branches need a token scoped to `leanprover-community/batteries`
583+ # for the labelling API; `lean-pr-testing-*` branches need one scoped to `leanprover/lean4`.
584+ app-id : ${{ startsWith(github.ref_name, 'batteries-pr-testing-') && secrets.MATHLIB_NIGHTLY_TESTING_APP_ID || secrets.MATHLIB_LEAN_PR_TESTING_APP_ID }}
585+ private-key : ${{ startsWith(github.ref_name, 'batteries-pr-testing-') && secrets.MATHLIB_NIGHTLY_TESTING_PRIVATE_KEY || secrets.MATHLIB_LEAN_PR_TESTING_PRIVATE_KEY }}
586+ owner : ${{ startsWith(github.ref_name, 'batteries-pr-testing-') && 'leanprover-community' || 'leanprover' }}
587+ repositories : ${{ startsWith(github.ref_name, 'batteries-pr-testing-') && 'batteries' || 'lean4' }}
583588 # The create-github-app-token README states that this token is masked and will not be logged accidentally.
584589 - name : Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
585590 if : ${{ always() && github.repository == 'leanprover-community/mathlib4-nightly-testing' && (startsWith(github.ref_name, 'lean-pr-testing-') || startsWith(github.ref_name, 'batteries-pr-testing-')) }}
@@ -618,7 +623,7 @@ jobs:
618623 fetch-depth : 1
619624
620625 - name : Configure Lean
621- uses : leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4 .0
626+ uses : leanprover/lean-action@38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9 # v1.5 .0
622627 with :
623628 auto-config : false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
624629 use-github-cache : false
@@ -687,9 +692,11 @@ jobs:
687692 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
688693 with :
689694 ref : ${{ inputs.pr_branch_ref }}
695+ # Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
696+ persist-credentials : false
690697
691698 - name : Configure Lean
692- uses : leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4 .0
699+ uses : leanprover/lean-action@38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9 # v1.5 .0
693700 with :
694701 auto-config : false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
695702 use-github-cache : false
@@ -731,17 +738,36 @@ jobs:
731738 run : |
732739 lake exe graph
733740
741+ - name : Checkout local actions
742+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
743+ with :
744+ ref : ${{ github.workflow_sha }}
745+ fetch-depth : 1
746+ sparse-checkout : .github/actions
747+ path : workflow-actions
748+
749+ - name : Get mathlib-ci
750+ uses : ./workflow-actions/.github/actions/get-mathlib-ci
751+
752+ - name : dump declarations and transitive-import counts
753+ run : |
754+ lake env lean --run "${CI_SCRIPTS_DIR}/pr_summary/dumpReasonableDecls.lean" \
755+ --out decls.txt --imports-out imports.json Mathlib
756+
734757 - name : upload the import graph
735- uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
758+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
736759 with :
737760 name : import-graph
738- path : import_graph.dot
739- # # the default is 90, but we build often, so unless there's a reason
740- # # to care about old copies in the future, just say 7 days for now
741- retention-days : 7
761+ path : |
762+ import_graph.dot
763+ decls.txt
764+ imports.json
765+ # # Master pushes: 90 days, so later PRs forked from these commits
766+ # # can consume the dumps from the artifact. Other branches: 7 days.
767+ retention-days : ${{ github.ref == 'refs/heads/master' && '90' || '7' }}
742768
743769 - name : clean up the import graph file
744- run : rm import_graph.dot
770+ run : rm -f import_graph.dot decls.txt imports.json
745771
746772 - name : check all scripts build successfully
747773 run : |
@@ -874,7 +900,7 @@ jobs:
874900 steps.get-label-actor.outputs.username != 'mathlib-update-dependencies' &&
875901 steps.get-label-actor.outputs.username != 'mathlib-splicebot'
876902 name: check team membership
877- uses: tspascoal/get-user-teams-membership@57e9f42acd78f4d0f496b3be4368fc5f62696662 # v3 .0.0
903+ uses: tspascoal/get-user-teams-membership@818140d631d5f29f26b151afbe4179f87d9ceb5e # v4 .0.1
878904 id: actorTeams
879905 with:
880906 organization: leanprover-community # optional. Default value ${{ github.repository_owner }}
0 commit comments