feat: use shallow clone in prepare and emit-build-metadata jobs#29807
Conversation
Neither job needs git history: prepare only reads config files and emit-build-metadata only runs git rev-parse HEAD (always present in shallow clones). Dropping fetch-depth: 0 switches to the default depth-1 shallow clone, saving ~1 min of checkout time. Ref: MCWP-574
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Pull request overview
This PR optimizes the GitHub Actions build pipeline by switching the prepare and emit-build-metadata jobs in .github/workflows/build.yml from full-history checkouts (fetch-depth: 0) to the default shallow checkout (fetch-depth: 1), reducing checkout time without impacting job behavior (these jobs only read files and/or use git rev-parse HEAD, which works on shallow clones).
Changes:
- Removed
fetch-depth: 0from thepreparejob checkout step. - Removed
fetch-depth: 0from theemit-build-metadatajob checkout step.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: This is a pure CI/build infrastructure optimization with no impact on:
The change only affects how the repository is cloned during the build pipeline — it does not modify any application code, test files, or shared components. No E2E tests need to run to validate this change, as it cannot break any app behavior. No performance tests are needed either. Performance Test Selection: |
|



Description
The
prepareandemit-build-metadatajobs inbuild.ymlusefetch-depth: 0(full git history clone), which takes ~1m 10s each (median, n=21). Neither job performs any git history operations:prepare: readsbuilds.ymlviafs.readFileSyncand runsvalidate-build-config.js(zero git commands)emit-build-metadata: runsgit rev-parse HEAD(works on shallow clones) andget-build-metadata.shwhich only reads files (zero git commands)Removing
fetch-depth: 0defaults tofetch-depth: 1(shallow clone), reducing checkout from ~70s to ~10-15s per job.Expected saving: ~1m 50s - 2m 10s per pipeline run across both jobs. Also eliminates a tail-risk outlier where
emit-build-metadatacheckout took 6m 45s.Part of MCWP-574 (pipeline optimization series: PR 3 of 4).
Changelog
CHANGELOG entry: null
Related issues
Fixes: MCWP-574
Manual testing steps
Screenshots/Recordings
Before
Not applicable (CI pipeline change, no UI).
After
Not applicable (CI pipeline change, no UI).
Pre-merge author checklist
Pre-merge reviewer checklist