-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[build] optimize fetch-depth across workflows #16966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 30d515d
Previous suggestionsSuggestions up to commit eb62caf
Suggestions up to commit 0053fec
Suggestions up to commit b8e1b39
Suggestions up to commit 4e3665a
Suggestions up to commit 6eba0f4
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this 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 aims to optimize fetch-depth across GitHub Actions workflows to reduce checkout times by avoiding unnecessary full git history fetches. However, the implementation contains critical breaking changes that will cause workflow failures.
Changes:
- Introduces auto-detection of optimal fetch-depth in bazel.yml based on event type (PR commits, push commits, or default)
- Adds tag-based depth calculation for changelog generation in pre-release.yml
- Removes explicit fetch-depth overrides from ci.yml, ci-grid-ui.yml, mirror-selenium-releases.yml, and pre-release.yml
- Removes input parameters and setup steps for dotnet-version, java-version, and browser-version from bazel.yml
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/bazel.yml | Adds auto-detect fetch-depth logic; removes dotnet-version, java-version, browser-version inputs and their corresponding setup steps; changes fetch-depth type from number to string |
| .github/workflows/pre-release.yml | Adds calculate-changelog-depth job to compute tag-based fetch depth; removes fetch-depth: 0 from two checkout steps; adds fetch-depth parameter to generate-changelogs job |
| .github/workflows/ci.yml | Removes fetch-depth: 50 from check-targets job (now uses auto-detect) |
| .github/workflows/ci-grid-ui.yml | Removes fetch-depth: 50 from checkout step (now uses default shallow) |
| .github/workflows/mirror-selenium-releases.yml | Removes fetch-depth: 0 from checkout step (now uses default shallow) |
1f3c790 to
a5e6981
Compare
4e3665a to
b8e1b39
Compare
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
|
Persistent suggestions updated to latest commit b8e1b39 |
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
0053fec to
eb62caf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
User description
We are checking out more than we need to. A full fetch takes over a minute
We specify fetch depth a bunch of places we don't need to.
💥 What does this PR do?
Optimizes
fetch-depthacross workflows to avoid fetching full git history when not needed:fetch-depthoverrides from ci.yml, ci-grid-ui.yml, mirror-selenium-releases.yml, and pre-release.yml🔧 Implementation Notes
My first thought was to create a custom action for this. Turns out you can't have a custom action for checking out because you have to... check it out first.
Two distinct fetch-depth calculation strategies:
gh api🔄 Types of changes
PR Type
Enhancement
Description
Adds intelligent fetch-depth calculation for changelog generation
Uses GitHub API to count commits since previous release tag
Calculates optimal depth based on version pattern matching
Handles edge cases for first releases and missing tags gracefully
Diagram Walkthrough
File Walkthrough
pre-release.yml
Add tag-based fetch-depth calculation job.github/workflows/pre-release.yml
calculate-changelog-depthjob that determines optimalgit fetch depth
calculation
failures
generate-changelogsjob to depend on and use calculated depth