Skip to content

feat: use shallow clone in prepare and emit-build-metadata jobs#29807

Merged
Qbandev merged 2 commits into
mainfrom
feat/mcwp-574-shallow-clone-prepare
May 7, 2026
Merged

feat: use shallow clone in prepare and emit-build-metadata jobs#29807
Qbandev merged 2 commits into
mainfrom
feat/mcwp-574-shallow-clone-prepare

Conversation

@Qbandev
Copy link
Copy Markdown
Contributor

@Qbandev Qbandev commented May 6, 2026

Description

The prepare and emit-build-metadata jobs in build.yml use fetch-depth: 0 (full git history clone), which takes ~1m 10s each (median, n=21). Neither job performs any git history operations:

  • prepare: reads builds.yml via fs.readFileSync and runs validate-build-config.js (zero git commands)
  • emit-build-metadata: runs git rev-parse HEAD (works on shallow clones) and get-build-metadata.sh which only reads files (zero git commands)

Removing fetch-depth: 0 defaults to fetch-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-metadata checkout 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

Feature: Shallow clone in build pipeline

  Scenario: prepare job completes with shallow clone
    Given a production build is triggered via workflow_dispatch on build.yml
      And skip_version_bump is true

    When the prepare job runs
    Then the actions/checkout step completes in ~10-15s (down from ~70s)
      And the prepare job outputs are identical to a full-clone run

  Scenario: emit-build-metadata job completes with shallow clone
    Given a production build completes successfully

    When the emit-build-metadata job runs
    Then the actions/checkout step completes in ~10-15s
      And built_commit_sha, semantic_version, and version codes are output correctly

  Scenario: version-bump commit ref works with shallow clone
    Given a production build is triggered with skip_version_bump false

    When the prepare job checks out the version-bump commit hash
    Then actions/checkout fetches the specific commit successfully
      And the prepare job completes without errors

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

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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
@metamaskbotv2 metamaskbotv2 Bot added the team-dev-ops DevOps team label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

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.

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 6, 2026
@Qbandev Qbandev added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label May 6, 2026
@Qbandev Qbandev marked this pull request as ready for review May 6, 2026 15:42
@Qbandev Qbandev requested a review from a team as a code owner May 6, 2026 15:42
@Qbandev Qbandev removed size-XS pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels May 6, 2026
@Qbandev Qbandev requested a review from Copilot May 6, 2026 15:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: 0 from the prepare job checkout step.
  • Removed fetch-depth: 0 from the emit-build-metadata job checkout step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 97%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR makes a single, minimal change to .github/workflows/build.yml: removing fetch-depth: 0 from two actions/checkout@v4 steps. This changes the git checkout behavior from a full history clone to the default shallow clone (depth 1) in the prepare and setup-dependencies jobs of the build workflow.

This is a pure CI/build infrastructure optimization with no impact on:

  1. App source code or functionality
  2. E2E test logic or test infrastructure
  3. Performance characteristics of the app
  4. Any user-facing features or flows

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:
The change is a CI workflow optimization (removing fetch-depth: 0 from checkout steps) with no impact on app code, rendering, data loading, or any performance-sensitive paths. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@Qbandev Qbandev added the Code Impact - Low Minor code change that can safely applied to the codebase label May 6, 2026
@Qbandev Qbandev added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit a492e34 May 7, 2026
65 of 83 checks passed
@Qbandev Qbandev deleted the feat/mcwp-574-shallow-clone-prepare branch May 7, 2026 06:59
@github-actions github-actions Bot locked and limited conversation to collaborators May 7, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Code Impact - Low Minor code change that can safely applied to the codebase no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-XS team-dev-ops DevOps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants