{{ message }}
Repository navigation
Conversation
natsu0529
marked this pull request as ready for review
July 6, 2026 12:29
Contributor
There was a problem hiding this comment.
Pull request overview
Adds JSON export capabilities to gh pr create while preserving its existing --template/-T PR-body-template flag, enabling scripts to reliably capture metadata (id/number/url) from newly created pull requests.
Changes:
- Introduces a
cmdutil.AddJSONAndJQFlagshelper to support--jsonand--jqwithout also defining an output--templateflag (and without shorthands). - Extends
gh pr createto emit JSON (and optional jq-filtered output) for the created PR, exportingid,number, andurl. - Updates API query + unit/acceptance coverage to include PR
numberand validate JSON/jq flows.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #11247.
Adds
--jsonand--jqsupport togh pr createwithout taking over the existing PR-template--templateflag.Details
id,number, andurlfrom pull request creation so they can be exported as JSON.--jsonand--jqbut cannot expose the output-formatting--templateflag.Validation
go test ./pkg/cmdutilgo test ./pkg/cmd/pr/creatego test ./apienv -i HOME="$HOME" PATH="$PATH" USER="$USER" TMPDIR="${TMPDIR:-/tmp}" TERM=xterm-256color go test ./...env -u NO_COLOR TERM=xterm-256color PATH="$(go env GOPATH)/bin:$PATH" make lintNote: a first
go test ./...run in the local shell failed because the shell environment hadTERM=dumb,NO_COLOR=1, andPAGER=cat; rerunning in a clean terminal-like environment passed.