Skip to content

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Sep 23, 2025

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.

@szokeasaurusrex szokeasaurusrex requested a review from a team as a code owner September 23, 2025 09:40
@szokeasaurusrex szokeasaurusrex enabled auto-merge (squash) September 23, 2025 09:40
Copy link

linear bot commented Sep 23, 2025

@szokeasaurusrex szokeasaurusrex changed the title revert: "feat: Add GitHub Actions base branch detection for EME-320 (#2776)" revert: Revert GHA base branch detection (#2776) Sep 23, 2025
@szokeasaurusrex
Copy link
Member Author

@runningcode, would appreciate if you can debug why #2776 failed on push, and open a new PR which also works on push. In your new PR, please also add a test which sets the GitHub Actions environment variables in a way to simulate that we are being run on push 🙏

Comment on lines 176 to 183
.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) => {

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 necessary refs/remotes/{remote_name}/HEAD reference. When git_repo_base_ref() fails, it returns None, 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 to git_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.

@szokeasaurusrex szokeasaurusrex merged commit c0beb47 into master Sep 23, 2025
25 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/revert-base-branch-gha-detection branch September 23, 2025 09:45
runningcode added a commit that referenced this pull request Sep 23, 2025
runningcode added a commit that referenced this pull request Sep 24, 2025
## 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants