Skip to content

Commit ad1388b

Browse files
kim-emclaude
andcommitted
feat(ci): upload crossref-tags baseline artifact on every build
The orchestrator that posts the PR comment used to render every cross-reference tag in any file the PR touched. A maintenance PR that touches a thousand files (without changing tags) would still fire on hundreds of unchanged tags. The right semantics is to subtract tags that already existed at the PR's merge-base commit. This change unconditionally uploads the dump output as a plain `crossref-tags-baseline` artifact (5-day retention, ~55 KB). The privileged workflow_run job (crossref_review.yml + mathlib-ci's post-comment.sh) looks up the PR's merge-base SHA via the GitHub compare API, downloads the matching master baseline, and passes it to crossref-render via `--baseline-tsv`. Only rows that don't match a baseline row verbatim are rendered. PR runs still also emit the privileged `crossref-tags-bridge` artifact for the workflow_run consumer; non-PR (master / bors / staging) runs only upload the plain baseline. Cost: ~2 seconds per non-PR build to run the dump (cached Mathlib build is already loaded). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 8e5f468 commit ad1388b

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

.github/workflows/build_template.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -745,17 +745,26 @@ jobs:
745745
- name: clean up the import graph file
746746
run: rm import_graph.dot
747747

748-
# PR-only: this only feeds crossref_review.yml's PR comment.
749-
# See scripts/dump_crossref_tags.lean for the output format and the
750-
# (defence-in-depth) size cap; the trusted bound is in mathlib-ci's
751-
# post-comment.sh.
748+
# Always-on: produce the TSV for every build (PR + push to master).
749+
# Master pushes upload it as a plain artifact (`crossref-tags-baseline`)
750+
# so that workflow_run jobs on PRs can subtract the merge-base baseline
751+
# and only render tags this PR actually changed.
752+
# PR runs additionally emit a privileged bridge artifact for
753+
# `crossref_review.yml` to consume.
754+
# See scripts/dump_crossref_tags.lean for the output format.
752755
- name: dump cross-reference tags to TSV
753-
if: github.event.pull_request.number != ''
754756
run: lake env lean --run scripts/dump_crossref_tags.lean crossref-tags.tsv
755757

758+
- name: upload crossref-tags baseline artifact
759+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
760+
with:
761+
name: crossref-tags-baseline
762+
path: crossref-tags.tsv
763+
retention-days: 5
764+
756765
- name: prepare crossref bridge outputs
757-
# We only emit the crossref bridge artifact when this build is for a PR
758-
# (the `crossref_review.yml` workflow_run job has nothing to post otherwise).
766+
# The privileged crossref_review.yml workflow_run job only fires
767+
# for PRs; non-PR builds don't need the bridge artifact.
759768
id: crossref_outputs
760769
env:
761770
EVENT_NAME: ${{ github.event_name }}

0 commit comments

Comments
 (0)