KEMBAR78
2.66.0 regression: `gh pr` subcommands don't work anymore if called outside of Git repository · Issue #10352 · cli/cli · GitHub
Skip to content

2.66.0 regression: gh pr subcommands don't work anymore if called outside of Git repository #10352

@rd-yan-farba

Description

@rd-yan-farba

Describe the bug

Hi dear team!

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

  1. Upgrade to GitHub CLI 2.66.0
  2. Run any gh pr subcommand (e.g. gh pr view <url>) outside of git repository
  3. 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.

Metadata

Metadata

Labels

bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsneeds-triageneeds to be reviewedp1Affects a large population and inhibits work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions