Repository navigation
ci: shallow checkout with on-demand base fetch (issue #306, B5) - #329
Merged
Merged
Conversation
B5 of issue #306: change detection only needs the base commit, so fetch-depth: 0 (full ~5 GB history clone) is unnecessary in quarto-publish.yml. - fetch-depth: 1 in the build-deploy checkout - Detect changed QMD files fetches the base SHA on demand with `git fetch --no-tags --depth=1 origin "$BASE_SHA"` before diffing; on fetch failure it falls back to a full build (need_julia=true, need_python=true, has_changes=false), matching the existing no-base-SHA path - so a missing base commit degrades to today's behaviour instead of failing. Verified safe: - date-modified: last-modified does NOT depend on git history: a local render of a file with mtime 2020-01-01 (git log saying 2026) renders "January 1, 2020" - Quarto uses the file mtime, which actions/checkout preserves on shallow clones. So displayed dates are unaffected. - git diff --name-only $BASE_SHA HEAD works after the on-demand fetch (tested against a real shallow clone in /tmp). - Commit-and-push from shallow checkouts (the "Commit updated dependency files" step) works: tested commit+push from a depth-1 clone. - ci-benchmark.yml keeps fetch-depth: 0 (cold-cache benchmark renders legitimately need full history); quarto-publish-update-cache.yml also keeps it - it pushes dependency-update commits to main and those are safest from a full clone. Co-Authored-By: Claude Code <noreply@anthropic.com>
Contributor
✅ QMD Format CheckNo new QMD tutorial files to check.
|
16 of 21 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #306 item B5 (Checkout 减负): the "Github Page" deploy workflow checked out the full ~5 GB git history (
fetch-depth: 0) on every build, but its change-detection step only ever needs two commits — HEAD and the base SHA.fetch-depth: 1inquarto-publish.ymlbuild-deploy checkout.git fetch --no-tags --depth=1 origin "$BASE_SHA"beforegit diff.need_julia=true,need_python=true,has_changes=false) instead of failing the workflow.Why
date-modified: last-modifiedis safe (verified, not assumed)_quarto.ymlsetsdate-modified: last-modifiedon every page. Before changing anything I verified whether Quarto resolves this from git history or from the filesystem:.qmdwithdate-modified: last-modifiedand set the file's mtime to2020-01-01while git log reported 2026 → Quarto rendered "January 1, 2020".actions/checkoutpreserves mtimes on shallow clones, so displayed dates are unaffected by this change.Other behaviours verified
git diff --name-only --diff-filter=ACMR "$BASE_SHA" HEADworks in a real shallow clone after the on-demand fetch (tested locally against a constructed shallow repo).What was deliberately NOT changed
ci-benchmark.ymlkeepsfetch-depth: 0— the benchmark exists to measure cold-cache full builds and legitimately needs full history.quarto-publish-update-cache.ymlkeepsfetch-depth: 0— it commits and pushes dependency-update commits to main; keeping the full clone there is the conservative choice for a workflow that runs weekly and doesn't pay the ~1 min checkout on every PR.Expected benefit
Test plan
🤖 Generated with Claude Code