Closed tnorthcutt closed 2 years ago
Thanks for reporting😃 Looks like you are not getting the default branch name. What does the following return on the target repository?
gh repo view --json defaultBranchRef
@seachicken thanks for the reply! Here's what I get:
» gh repo view --json defaultBranchRef
{
"defaultBranchRef": {
"name": "staging"
}
}
Perhaps something is wrong with getting hostname or repoName. https://github.com/seachicken/gh-poi/blob/84e6f907c5801f68df15be9907f77078dd511e91/conn/command.go#L45
git remote -v
to display origin address
# for example:
origin git@github.com:seachicken/gh-poi.git (fetch)
origin git@github.com:seachicken/gh-poi.git (push)
ssh -T -G {hostname (e.g. github.com)} | grep hostname
to see if hostname can be obtained.gh repo view {hostname}/{repoName (e.g. seachicken/gh-poi)} --json defaultBranchRef
Thank you! Here's what I get – I'm not sure I did exactly what you were asking; please let me know if I've messed up anywhere 😊
» git remote -v
origin git@github.com:apiabroad/portal-student.git (fetch)
origin git@github.com:apiabroad/portal-student.git (push)
» ssh -T -G github.com | grep hostname
hostname ssh.github.com
canonicalizehostname false
» gh repo view ssh.github.com/apiabroad/portal-student --json defaultBranchRef
{
"defaultBranchRef": {
"name": "staging"
}
}
It may have something to do with being able to get ssh.github.com
. (I can get github.com
in my environment.)
gh api --hostname ssh.github.com repos/apiabroad/portal-student --silent
related code: https://github.com/seachicken/gh-poi/blob/84e6f907c5801f68df15be9907f77078dd511e91/conn/command.go#L17
~/.ssh/config
have this setting in your environment?
https://docs.github.com/ja/enterprise-cloud@latest/authentication/troubleshooting-ssh/using-ssh-over-the-https-port#enabling-ssh-connections-over-httpsHmm, that does result in an error:
» gh api --hostname ssh.github.com repos/apiabroad/portal-student --silent
Get "https://api.ssh.github.com/repos/apiabroad/portal-student": x509: “*.github.com” certificate name does not match input
I do have this in my ~/.ssh/config
:
Host github.com
Hostname ssh.github.com
Port 443
ForwardAgent yes
ssh.github.com
is now supported. https://github.com/seachicken/gh-poi/releases/tag/v0.6.4
Can you try it?
gh ext upgrade poi
Unfortunately I still get this output after upgrading:
» gh poi --dry-run
== DRY RUN ==
✕ Fetching pull requests...
failed to run external command: git, args: [branch --merged origin/]
exit status 128
Thanks for checking 🙂
Added error handling when GitHub API response cannot be parsed. You may get a different error message after updating.
gh ext upgrade poi
https://github.com/seachicken/gh-poi/releases/tag/v0.6.6
Maybe the response with all the options set can't be parsed.
gh repo view github.com/apiabroad/portal-student --json owner --json name --json parent --json defaultBranchRef
Interesting, a new error!
Does this provide more/better information?
» gh ext upgrade poi
✓ Successfully upgraded extension poi
» gh poi --dry-run
== DRY RUN ==
✕ Fetching pull requests...
error unmarshaling response: invalid character '\x1b' looking for beginning of value
» gh repo view github.com/apiabroad/portal-student --json owner --json name --json parent --json defaultBranchRef
{
"defaultBranchRef": {
"name": "staging"
},
"name": "portal-student",
"owner": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"login": "apiabroad"
},
"parent": null
}
I successfully parsed the JSON you taught me. Maybe another JSON is being retrieved, so if you could let me know the result, I might be able to solve the problem 🙂
gh ext upgrade poi
gh poi --debug | grep "repo view"
Thank you! Here's what I get after upgrading:
» gh poi --debug | grep "repo view"
error unmarshaling response: invalid character '\x1b' looking for beginning of value
run gh [repo view github.com/apiabroad/portal-student --json owner --json name --json parent --json defaultBranchRef] -> {
And here's the full output, in case it's helpful:
» gh poi --debug
run git [remote -v] -> origin git@github.com:apiabroad/portal-student.git (fetch)
origin git@github.com:apiabroad/portal-student.git (push)
run ssh [-T -G github.com] -> *****
run gh [repo view github.com/apiabroad/portal-student --json owner --json name --json parent --json defaultBranchRef] -> {
"defaultBranchRef": {
"name": "staging"
},
"name": "portal-student",
"owner": {
"id": "MDEyOk9yZ2FuaXphdGlvbjE0ODgwNDYy",
"login": "apiabroad"
},
"parent": null
}
✕ Fetching pull requests...
error unmarshaling response: invalid character '\x1b' looking for beginning of value
Perhaps your environment was not decoding the JSON because the output of the gh pr view
included color char codes.
I have created a version that works without including the color char code, so if possible, could you please help me confirm that it works?
https://github.com/seachicken/gh-poi/pull/88
gh ext remove poi
gh ext install seachicken/gh-poi --pin v0.7.2-pre0
That works!! Magnificent 🎉
Yay!!! Thank you 😍 I'll release it later.
@tnorthcutt I released v0.7.2! To remove version pinning by --pin
, run gh ext upgrade poi --force
.
@seachicken thank you!
Just FYI gh
doesn't allow upgrading pinned extensions:
» gh ext upgrade poi --force
X Failed upgrading extension poi: pinned extensions can not be upgraded
So I just did gh ext remove poi
and then gh ext install seachicken/gh-poi
and that worked great!
Describe the bug When I install this extension and try to run it with
gh poi --dry-run
, I receive the following output:Your Environment
gh --version
):2.18.0
gh ext ls
):v0.6.3
2.37.0 (Apple Git-136)
This seems to be the case regardless of which repo I run it in.
If I run
git branch --merged origin
orgit branch --merged origin/
, I get this output:I'm not sure how to further debug this, but I'm happy to help however I can!