Skip to content

Commit 44f926e

Browse files
committed
fix(bugfix): use UPSTREAM_REMOTE in unauthenticated fallback
The git-based repo name and default branch detection hardcoded "origin", which breaks when origin points to the fork. Use the UPSTREAM_REMOTE identified in Step 2b. Made-with: Cursor
1 parent 51342d4 commit 44f926e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • workflows/bugfix/.claude/skills/pr

workflows/bugfix/.claude/skills/pr/SKILL.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,15 @@ gh repo view --json nameWithOwner,defaultBranchRef --jq '{nameWithOwner, default
192192
This returns both the repo name and its default branch. Record
193193
`UPSTREAM_OWNER/REPO` and `DEFAULT_BRANCH` from the output.
194194

195-
If `gh` is NOT authenticated, extract from the git remote:
195+
If `gh` is NOT authenticated, extract from the upstream remote (identified in
196+
Step 2b as `UPSTREAM_REMOTE`):
196197

197198
```bash
198-
# Repo name
199-
git remote get-url origin | sed -E 's#.*/([^/]+/[^/]+?)(\.git)?$#\1#'
199+
# Repo name (use UPSTREAM_REMOTE, not necessarily origin — origin may be the fork)
200+
git remote get-url UPSTREAM_REMOTE | sed -E 's#.*/([^/]+/[^/]+?)(\.git)?$#\1#'
200201

201202
# Default branch
202-
git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}'
203+
git remote show UPSTREAM_REMOTE 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}'
203204
```
204205

205206
Record the results as `UPSTREAM_OWNER/REPO` and `DEFAULT_BRANCH`.

0 commit comments

Comments
 (0)