ci(homebrew): handle existing upstream remote and main base#1385
ci(homebrew): handle existing upstream remote and main base#1385
Conversation
PR intake checks found warnings (non-blocking)Fast safe checks found advisory issues. CI lint/test/build gates still enforce merge quality.
Action items:
Run logs: https://github.com/zeroclaw-labs/zeroclaw/actions/runs/22275210822 Detected blocking line issues (sample):
Detected advisory line issues (sample):
Workflow files changed in this PR:
Reminder: workflow changes require owner approval via |
There was a problem hiding this comment.
Pull request overview
This PR updates the Homebrew CI workflow to handle cases where the upstream remote already exists when cloning a fork, and implements dynamic detection of the upstream repository's default branch (main vs master). The changes address failures in the Homebrew publish workflow when working with forked repositories.
Changes:
- Add logic to handle existing upstream remote by using
set-urlinstead ofadd - Dynamically detect whether upstream uses "main" or "master" branch
- Update branch checkout and PR creation to use detected branch name
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| gh pr create \ | ||
| --repo "$UPSTREAM_REPO" \ | ||
| --base master \ | ||
| --base main \ |
There was a problem hiding this comment.
The PR base branch is hardcoded to "main" but the earlier logic detects whether the upstream uses "main" or "master" and stores it in the upstream_ref variable. However, upstream_ref is a local variable in the patch_formula step and is not available in this later push-and-PR step. This creates an inconsistency: the branch is created based on the detected upstream_ref (line 146), but the PR always targets "main" regardless of what was detected.
If the upstream repository still uses "master", this will cause the PR creation to fail because the base branch won't exist or won't match the branch that was actually checked out.
Fix Homebrew publish failure when upstream remote already exists after fork clone, and target upstream main branch with master fallback for fetch.