-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
enhancementa request to improve CLIa request to improve CLIhelp wantedContributions welcomeContributions welcome
Description
Describe the bug
When using the {owner} placeholder in gh api, the chosen remote is whichever comes first when sort.Sort() is called on the remotes array.
❯ gh --version
gh version 2.30.0 (2023-05-30)
https://github.com/cli/cli/releases/tag/v2.30.0
Steps to reproduce the behavior
❯ cat .git/config
...
[remote "origin"]
url = git@github.com:whi-tw/dnscontrol.git
fetch = +refs/heads/*:refs/remotes/origin/*
gh-resolved = base
[remote "upstream"]
url = git@github.com:StackExchange/dnscontrol.git
fetch = +refs/heads/*:refs/remotes/upstream/*
gh api "repos/{owner}/{repo}" -q '.full_name'
Expected vs actual behavior
Expected
'whi-tw/dnscontrol'
Actual
'StackExchange/dnscontrol'
Logs
❯ GH_DEBUG=api gh api "repos/{owner}/{repo}" -q '.full_name'
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2023-06-19 14:25:57.345605 +0100 BST m=+0.088005710
* Request to https://api.github.com/repos/StackExchange/dnscontrol
Metadata
Metadata
Assignees
Labels
enhancementa request to improve CLIa request to improve CLIhelp wantedContributions welcomeContributions welcome