You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh pr edit https://... --add-label ... does not deduce --repo from the URL automatically #11055
[b]$ gh pr edit https://github.com/user202729/sage/pull/1 --add-label "test label"
failed to run git: fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
[b]$ GH_DEBUG=api gh pr edit https://github.com/user202729/sage/pull/1 --add-label "test label"
[git remote -v]
failed to run git: fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Here, we need a Detector (to make sure we're using the available API features), but to create that we need to know the host. Since, the current directory is not a git repo, call to BaseRepo fails, and so we return with that error.
As a quick solution, we can check if the SelectorArg is a valid PR URL and grab the host name from that. However, I have to check and see in how many places we're doing this and would need to apply this fix.
What do you think?
UPDATE: Basically, this means we have to export the Finder's parseURL method and use it in editRun:
Just released https://github.com/cli/cli/releases/tag/v2.74.1 which should resolve this. Unfortunately, it might take a little time to get into the runner images so in the meantime you might want to use the Installation Instructions to manually pull the release in (and I'd certainly appreciate if anyone did this to verify our fix as well).
so in the meantime you might want to use the Installation Instructions to manually pull the release in (and I'd certainly appreciate if anyone did this to verify our fix as well).
So we tried this by doing apt-get update; apt-get install gh and the apt repo does not appear to have the fix either: gh is already the newest version (2.74.0)
Activity
babakks commentedon Jun 2, 2025
Thanks for reporting this! 🙏 Checking the other issue you linked, I assume this is the command you're trying to run:
gh pr edit https://github.com/sagemath/sage/pull/40192 --add-label "s: needs review"If so, could you please run it with the
GH_DEBUG=apienv var and share the output with me? I mean:GH_DEBUG=api gh pr edit https://github.com/sagemath/sage/pull/40192 --add-label "s: needs review"Please don't forget to remove unnecessary/private details.
williammartin commentedon Jun 2, 2025
I wonder if this might have the same underlying reason as #10071 (comment)
user202729 commentedon Jun 2, 2025
I test on my fork
Only difference is
[git remote -v].babakks commentedon Jun 2, 2025
@williammartin, Seems like we have a circular kind of dependency to
BaseRepo:cli/pkg/cmd/pr/edit/edit.go
Lines 207 to 222 in b4ab343
Here, we need a
Detector(to make sure we're using the available API features), but to create that we need to know the host. Since, the current directory is not a git repo, call toBaseRepofails, and so we return with that error.As a quick solution, we can check if the
SelectorArgis a valid PR URL and grab the host name from that. However, I have to check and see in how many places we're doing this and would need to apply this fix.What do you think?
UPDATE: Basically, this means we have to export the Finder's
parseURLmethod and use it ineditRun:cli/pkg/cmd/pr/shared/finder.go
Line 305 in b4ab343
williammartin commentedon Jun 10, 2025
Just released https://github.com/cli/cli/releases/tag/v2.74.1 which should resolve this. Unfortunately, it might take a little time to get into the runner images so in the meantime you might want to use the Installation Instructions to manually pull the release in (and I'd certainly appreciate if anyone did this to verify our fix as well).
Extremely sorry for the inconvenience 🙏
Manually update `gh` to fix PR labeling for now (#5665)
danakj commentedon Jun 13, 2025
So we tried this by doing
apt-get update; apt-get install ghand the apt repo does not appear to have the fix either:gh is already the newest version (2.74.0)Add repo flag to gh (#5669)
williammartin commentedon Jun 13, 2025
@danakj not sure about that, it is definitely in the repo.
danakj commentedon Jun 13, 2025
Interesting, dunno. We solved this another way by adding
--repoto the command line for now.