Repository navigation
fix: Claude workflow fails on fork PRs when head branch is 'main' - #685
Merged
Merged
Conversation
When a fork PR uses 'main' as its head branch (common when contributors push to their fork's default branch), the issue-handler job fails with "fatal: a branch named 'main' already exists" because the initial checkout already created a local 'main' branch. Additionally, after redirecting origin to the fork, origin/$BASE_BRANCH gets overwritten with the fork's ref, corrupting the diff base. Fixes: - Use fixed branch name 'pr-head' with -B (force-create) to avoid name collisions with existing branches - Save base branch SHA before any origin URL changes so the diff always compares against the correct base Tested against: https://github.com/amd/gaia/actions/runs/23859641383 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
itomek
approved these changes
Apr 1, 2026
Merged
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 10, 2026
Release notes for v0.17.2. See [docs/releases/v0.17.2.mdx](https://github.com/amd/gaia/blob/v0.17.2-release/docs/releases/v0.17.2.mdx) for the full body. **Headline features:** - One-click desktop installers for Windows, macOS, and Linux (#731 + #743) - Customizable agents and Builder Agent (#720) - MCP tool execution visibility in Agent Activity panel (#717) **Security:** RAG cache integrity verification (#722, closes #447) **Bug fixes:** drag-and-drop upload in any browser (#729), Linux install fixes (#743) **Release & CI:** unified publish workflow (#715), Claude review on fork PRs (#685), npm OIDC fix (#683), webui package.json sync (#682) Full changelog: v0.17.1...v0.17.2 --------- Co-authored-by: Tomasz Iniewicz <tomasz@iniewicz.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fatal: a branch named 'main' already existserror when reviewing fork PRs where the contributor's head branch ismain(their default branch)origin/$BASE_BRANCHgets overwritten, so save the base SHA before any URL changespr-headwith-B(force-create) instead of-b $HEAD_REFto avoid name collisionsRoot Cause
When a fork PR uses
mainas its head branch (PR #684):actions/checkoutcreates localmainbranch from the base repogit checkout -b main origin/mainfails becausemainalready existsgit fetch origin main(from fork) would overwriteorigin/main, making the diff compare fork-vs-fork instead of base-vs-forkFailed run: https://github.com/amd/gaia/actions/runs/23859641383/job/69562473226
Test plan
mainas head branch) — should succeed