Skip to content

Commit c47fb22

Browse files
authored
Merge pull request zeroclaw-labs#1385 from zeroclaw-labs/codex/homebrew-secret-fallback
ci(homebrew): handle existing upstream remote and main base
2 parents 9800895 + b96a547 commit c47fb22

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/pub-homebrew-core.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,19 @@ jobs:
131131
fi
132132
133133
if [[ "$DRY_RUN" == "false" ]]; then
134-
git -C "$repo_dir" remote add upstream "https://github.com/${UPSTREAM_REPO}.git"
135-
git -C "$repo_dir" fetch --depth=1 upstream master
134+
if git -C "$repo_dir" remote get-url upstream >/dev/null 2>&1; then
135+
git -C "$repo_dir" remote set-url upstream "https://github.com/${UPSTREAM_REPO}.git"
136+
else
137+
git -C "$repo_dir" remote add upstream "https://github.com/${UPSTREAM_REPO}.git"
138+
fi
139+
if git -C "$repo_dir" ls-remote --exit-code --heads upstream main >/dev/null 2>&1; then
140+
upstream_ref="main"
141+
else
142+
upstream_ref="master"
143+
fi
144+
git -C "$repo_dir" fetch --depth=1 upstream "$upstream_ref"
136145
branch_name="zeroclaw-${RELEASE_TAG}-${GITHUB_RUN_ID}"
137-
git -C "$repo_dir" checkout -B "$branch_name" upstream/master
146+
git -C "$repo_dir" checkout -B "$branch_name" "upstream/$upstream_ref"
138147
echo "branch_name=$branch_name" >> "$GITHUB_OUTPUT"
139148
fi
140149
@@ -196,7 +205,7 @@ jobs:
196205
197206
gh pr create \
198207
--repo "$UPSTREAM_REPO" \
199-
--base master \
208+
--base main \
200209
--head "${fork_owner}:${branch_name}" \
201210
--title "$pr_title" \
202211
--body "$pr_body"

0 commit comments

Comments
 (0)