Skip to content

Make pr create friendlier to wrapper scripts #3002

@jherland

Description

@jherland

Describe the feature or problem you’d like to solve

We write scripts that wrap and extend gh pr create, but it is hard to do so correctly when gh pr create does not signal clearly if a PR was in fact created, or what the resulting PR number is. (We do not redirect stdio as we want to preserve the interactivity of gh.)

  1. If you select Cancel in gh pr create, the program will still exit with code 0, so it is very hard for the wrapper to tell whether a PR was created at all.
  2. The PR created by gh pr create is not stored/communicated, and the wrapper must rely on error-prone tricks, like calling git pr list --limit=1 to deduce which PR was created.

Proposed solution

  1. gh pr create should exit with a non-zero code when the PR creation is cancelled by the user.
  2. Add an option or some other way for communicating the created PR number back to the caller. E.g. --save-pr <path> to have the PR number written into a file of the caller's choosing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLIgh-prrelating to the gh pr command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions