Skip to content

pr create push detection should work in repositories that are tracking only a single branch #2979

@jwodder

Description

@jwodder

I have a shell script that is run as part of a GitHub Actions workflow that, on occasion, clones a repository, creates, commits to, and pushes a branch, and then creates (or at least tries to) a pull request for the branch using gh pr create. However, gh is failing with "aborted: you must first push the current branch to a remote, or use the --head flag" despite the fact that the command immediately before it is "git push -u origin "$branch_name" (tried with & without the -u option).

  • The repository is public.
  • The remote URL used to check out the repository is of the form https://x-access-token:$GITHUB_TOKEN@github.com/$OWNER/$REPO, where the same token is also set as the $GITHUB_TOKEN environment variable.
  • The command succeeds if the --head option is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandp3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions