Skip to content

Commit 7c76156

Browse files
authored
release.sh: set gh pr repo explicitly (#685)
Derive owner/repo from the origin remote and pass --repo to both gh pr create calls so the release flow does not depend on gh's inferred default repo, which fails in clones with multiple remotes.
1 parent 5553ded commit 7c76156

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

release.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,15 @@ if [[ $confirm =~ ^[Yy]$ ]]; then
149149
for cmd in "${push_cmds[@]}"; do echo "+ $cmd"; bash -c "$cmd"; done
150150
echo "🎉 All pushes completed."
151151

152+
# --- resolve the GitHub repo explicitly so gh doesn't depend on a default ----
153+
# Clones with multiple remotes have no inferred default repo, which makes
154+
# `gh pr create` fail. Derive owner/repo from the origin remote URL.
155+
# Handles both https://github.com/owner/repo(.git) and git@github.com:owner/repo(.git)
156+
REPO_SLUG="$(git remote get-url origin | sed -E -e 's#\.git$##' -e 's#^.*github\.com[:/]##')"
157+
152158
echo; echo "📝 Opening sync PR ${RELEASE_BRANCH}${DEV_BRANCH}"
153159
gh pr create \
160+
--repo "$REPO_SLUG" \
154161
--base "$DEV_BRANCH" \
155162
--head "$RELEASE_BRANCH" \
156163
--title "Sync v${new_ver} version bump to dev" \
@@ -162,6 +169,7 @@ if [[ $confirm =~ ^[Yy]$ ]]; then
162169

163170
echo; echo "📝 Opening release PR ${RELEASE_BRANCH}${MAIN_BRANCH}"
164171
gh pr create \
172+
--repo "$REPO_SLUG" \
165173
--base "$MAIN_BRANCH" \
166174
--head "$RELEASE_BRANCH" \
167175
--title "Release v${new_ver}" \

0 commit comments

Comments
 (0)