Commit 268f375
feat: auto-fetch head-ref from GitHub Actions in detached HEAD state (#2805)
## Summary
- Add `get_github_head_ref()` function to automatically detect head
branch from GitHub Actions environment variables
- Integrate with upload command fallback chain to resolve detached HEAD
scenarios
- Use `GITHUB_HEAD_REF` for automatic head-ref detection in PR workflows
See context reference:
https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
## Context
Resolves EME-367 - Auto-fetch correct head-ref value in detached HEAD
state using GitHub Actions env variables. Follows the same pattern as
recent work on base SHA auto-fetching (#2799).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds get_github_head_ref() (reads GITHUB_HEAD_REF in pull_request) and
makes build upload prefer it before git head ref to handle detached
HEAD.
>
> - **Build Upload**:
> - Update `src/commands/build/upload.rs` head-ref resolution to first
use `get_github_head_ref()`; fall back to `git_repo_head_ref`.
> - **VCS Utils**:
> - Add `get_github_head_ref()` to read `GITHUB_HEAD_REF` when
`GITHUB_EVENT_NAME` is `pull_request` with debug logging.
> - Export and import updated in `utils::vcs` and upload command.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
332fe76. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6080089 commit 268f375
2 files changed
+21
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
378 | 393 | | |
379 | 394 | | |
380 | 395 | | |
| |||
0 commit comments