-
-
Notifications
You must be signed in to change notification settings - Fork 235
revert: Revert GHA base branch detection (#2776) #2789
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
revert: Revert GHA base branch detection (#2776) #2789
Conversation
@runningcode, would appreciate if you can debug why #2776 failed on |
.map(String::as_str) | ||
.map(Cow::Borrowed) | ||
.or_else(|| { | ||
// First try GitHub Actions environment variables | ||
get_github_base_ref().map(Cow::Owned) | ||
}) | ||
.or_else(|| { | ||
// Fallback to git repository introspection | ||
// Try to get the base ref from the VCS if not provided | ||
// This attempts to find the merge-base with the remote tracking branch | ||
repo_ref | ||
.and_then(|r| match git_repo_base_ref(r, &cached_remote) { | ||
Ok(base_ref_name) => { |
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.
Potential bug: Reverting the use of GITHUB_BASE_REF
causes base branch detection to fail in GitHub Actions PRs, as the git_repo_base_ref()
fallback is unreliable in that environment.
-
Description: The removal of logic that reads the
GITHUB_BASE_REF
environment variable introduces a functional regression. The fallback mechanism,git_repo_base_ref()
, attempts to find the base branch by introspecting the Git repository. However, this function often fails in GitHub Actions pull request workflows because they typically operate in a detached HEAD state and may use shallow clones, which lack the necessaryrefs/remotes/{remote_name}/HEAD
reference. Whengit_repo_base_ref()
fails, it returnsNone
, resulting in incomplete VCS context being sent to Sentry. This breaks build tracking and pull request analysis features for a common CI/CD use case. -
Suggested fix: Restore the logic that reads the
GITHUB_BASE_REF
environment variable as the primary method for detecting the base branch within GitHub Actions environments. This ensures reliable base branch detection in CI, falling back togit_repo_base_ref()
only when the environment variable is not present.
severity: 0.7, confidence: 0.95
Did we get this right? 👍 / 👎 to inform future reviews.
## Summary Reverts commit c0beb47 to restore the GitHub Actions base branch detection functionality that was previously implemented in #2776. ## Background The original GHA base branch detection was reverted in #2789 due to CI failures on master. However, those test failures were actually resolved separately in #2791 by adding `--log-level=error` to suppress warning messages in the integration tests. ## Changes This PR restores: - `get_github_base_ref()` function in `src/utils/vcs.rs` that detects base branch from `GITHUB_BASE_REF` environment variable - Integration of GHA base branch detection in the build upload command logic - Tests for the `get_github_base_ref()` function The test failures that caused the original revert have been resolved by the test fixes in #2791, so this functionality can now be safely restored. 🤖 Generated with [Claude Code](https://claude.ai/code)
This reverts commit b259595 from #2776
This change is causing CI to fail on
master
. As I would like to release Sentry CLI, we need to revert this to unblock the release process.