@@ -38,7 +38,7 @@ permissions:
3838
3939jobs :
4040 build :
41- if : true
41+ if : github.repository == 'leanprover-community/mathlib4'
4242 name : Build
4343 runs-on : bors
4444 outputs :
@@ -146,9 +146,8 @@ jobs:
146146 shell : bash # We're only building the `master` branch version of the tools, so don't need to run inside landrun.
147147 run : |
148148 cd master-branch
149- lake build cache mk_all check-yaml graph
149+ lake build cache check-yaml graph
150150 ls .lake/build/bin/cache
151- ls .lake/build/bin/mk_all
152151 ls .lake/build/bin/check-yaml
153152 ls .lake/packages/importGraph/.lake/build/bin/graph
154153
@@ -229,13 +228,11 @@ jobs:
229228 - name : update {Mathlib, Tactic, Counterexamples, Archive}.lean
230229 id : mk_all
231230 continue-on-error : true # Allow workflow to continue, outcome checked later
232- # This only runs `mk_all --check` from the `master-branch`, so doesn't need to be inside landrun
233- shell : bash
231+ # This runs `mk_all --check` from the `pr-branch` inside landrun
234232 run : |
235233 cd pr-branch
236-
237- echo "Running mk_all --check (from master-branch)..."
238- LAKE_HOME="$TOOLCHAIN_DIR" ../master-branch/.lake/build/bin/mk_all --check
234+ echo "Running mk_all --check (from pr-branch)..."
235+ lake exe mk_all --check
239236
240237 - name : begin gh-problem-match-wrap for build step
241238 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -432,6 +429,7 @@ jobs:
432429
433430 post_steps :
434431 name : Post-Build Step
432+ if : github.repository == 'leanprover-community/mathlib4'
435433 needs : [build]
436434 runs-on : ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
437435 steps :
@@ -513,20 +511,34 @@ jobs:
513511
514512 style_lint :
515513 name : Lint style
514+ if : github.repository == 'leanprover-community/mathlib4'
516515 runs-on : ubuntu-latest
517516 steps :
518517 - uses : leanprover-community/lint-style-action@f2e7272aad56233a642b08fe974cf09dd664b0c8 # 2025-05-22
519518 with :
520519 mode : check
521520 lint-bib-file : true
522521
522+ build_and_lint :
523+ name : CI Success
524+ if : github.repository == 'leanprover-community/mathlib4'
525+ needs : [style_lint, post_steps]
526+ runs-on : ubuntu-latest
527+ steps :
528+ - name : succeed
529+ run : |
530+ echo "Success: Required build and lint checks completed!"
531+
523532 final :
524533 name : Post-CI job
525- if : true
534+ if : github.repository == 'leanprover-community/mathlib4'
526535 needs : [style_lint, build, post_steps]
527536 runs-on : ubuntu-latest
528537 steps :
529- - id : PR
538+ # This action is used to determine the PR metadata in the event of a push.
539+ # If it is called from a PR from a fork, it will find nothing/irrelevant data.
540+ - if : github.event_name != 'pull_request_target'
541+ id : PR_from_push
530542 uses : 8BitJonny/gh-get-current-pr@08e737c57a3a4eb24cec6487664b243b77eb5e36 # 3.0.0
531543 # TODO: this may not work properly if the same commit is pushed to multiple branches:
532544 # https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -535,6 +547,13 @@ jobs:
535547 # Only return if PR is still open
536548 filterOutClosed : true
537549
550+ # Combine the output from the previous action with the metadata supplied by GitHub itself.
551+ - id : PR
552+ shell : bash
553+ run : |
554+ echo "number=${{ steps.PR_from_push.outputs.number || github.event.pull_request.number }}" >> $GITHUB_OUTPUT
555+ echo "pr_labels=${{ steps.PR_from_push.outputs.pr_labels || join(github.event.pull_request.labels.*.name, ',') }}" >> $GITHUB_OUTPUT
556+
538557 - if : contains(steps.PR.outputs.pr_labels, 'bench-after-CI')
539558 name : If `bench-after-CI` is present, add a `!bench` comment.
540559 uses : GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1
0 commit comments