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
2.66.0 regression: gh pr subcommands don't work anymore if called outside of Git repository #10352
After upgrading to GitHub CLI 2.66.0 we noticed that running gh pr <cmd> <url> fails with the message:
The error message was the following:
could not determine current branch: failed to run git: fatal: not a git repository (or any of the parent directories): .git
It happens when we run the commands outside of git repository.
We use the gh pr command in composite action, providing a valid token and using ${{ github.event.pull_request.html_url }} as PR URL. Previous versions worked without checking out the repository.
Affected version
2.66.0
Steps to reproduce the behavior
Upgrade to GitHub CLI 2.66.0
Run any gh pr subcommand (e.g. gh pr view <url>) outside of git repository
See error:
could not determine current branch: failed to run git: fatal: not a git repository (or any of the parent directories): .git
Expected vs actual behavior
Earlier version of gh pr worked in our workflows without checking out the repository.
We would expect it to work, since we use gh pr with explicit PR URL, in which base and head branches are set.
Thank you for raising this issue, @rd-yan-farba! 🙇 I'm going to begin digging into this and working with the other maintainers regarding the changes from #9208.
Reacted by Tim Loyer, Sergio Compean and Yan Farba
@rd-yan-farba : working with @jtmcg and @BagToad, we think we've gotten to the root of this issue and have been refactoring some code and tests to ensure this is properly addressed. we are hoping to cut a hotfix today and hope that we could follow up with you when its available for confirmation this is fixed.
Activity
andyfeller commentedon Jan 31, 2025
Thank you for raising this issue, @rd-yan-farba! 🙇 I'm going to begin digging into this and working with the other maintainers regarding the changes from #9208.
andyfeller commentedon Jan 31, 2025
@rd-yan-farba : working with @jtmcg and @BagToad, we think we've gotten to the root of this issue and have been refactoring some code and tests to ensure this is properly addressed. we are hoping to cut a hotfix today and hope that we could follow up with you when its available for confirmation this is fixed.
rd-yan-farba commentedon Feb 3, 2025
Thanks for the quick response and the hotfix!🚀 I can confirm the issue was resolved
build(deps): update cli/cli to v2.66.1
blackmann92 commentedon Feb 8, 2025
Hvala