Allow to pass on a template file to gh in issue pr create. Add default to config. - #266
Merged
Merged
Conversation
schpetbot
pushed a commit
that referenced
this pull request
Sep 1, 2026
#266 adds `-T/--template` and a `pr_template` config option, which are the right surface -- the names and the precedence are kept exactly as the contributor designed them. The mechanism cannot work, though, and I could not find a variant of it that does. The command already passes `--body <issue url>`, and #266 appends `--template` next to it. `gh` refuses that pair outright: `--template` is not supported when using `--body` or `--body-file` So every use of the new flag fails, and setting `pr_template` in config breaks `issue pr` on every invocation rather than only when the flag is passed. Dropping `--body` to make room for `--template` -- the obvious repair -- is worse. `gh` only consults a template when it is running interactively; without a body a non-TTY caller gets must provide `--title` and `--body` (or `--fill` ...) when not running interactively and no pull request at all. That would trade a broken flag for a command broken in CI, scripts, and agents. Handing `gh` a temporary file that already contains the template fails the same way, because the problem is the missing `--body`, not the file's contents. So the template is read here and folded into the body we already send, with the issue URL appended after it. The URL is what Linear matches on to attach the pull request to its issue, so it has to survive; putting it last leaves the template's prose as the first thing a reviewer reads. Every existing flag keeps working, because the argv shape is unchanged. Reading the file ourselves means we own its failures, and per CLAUDE.md an explicitly requested template that cannot be used is an error rather than a silent fallback to a URL-only body -- otherwise the user gets a pull request quietly missing the content they asked for. Missing paths, directories, non-regular files and unreadable files all produce a message naming the path. NUL bytes are rejected too: `Deno.readTextFile` does not refuse binary input, it substitutes U+FFFD and keeps the NULs, which `Deno.Command` then rejects with a bare TypeError that never mentions the file. One deliberate surface change: #266's description suggests `-T ""` to override a configured default. That worked only because an empty string happened to be falsy. It is now an explicit `--no-template` flag, and `-T ""` errors with a suggestion pointing at it. The generated skill docs under skills/ are left alone; they are produced from an installed binary out of band and are already stale on trunk.
schpetbot
pushed a commit
that referenced
this pull request
Sep 1, 2026
#266 adds `-T/--template` and a `pr_template` config option, which are the right surface -- the names and the precedence are kept exactly as the contributor designed them. The mechanism cannot work, though, and I could not find a variant of it that does. The command already passes `--body <issue url>`, and #266 appends `--template` next to it. `gh` refuses that pair outright: `--template` is not supported when using `--body` or `--body-file` So every use of the new flag fails, and setting `pr_template` in config breaks `issue pr` on every invocation rather than only when the flag is passed. Dropping `--body` to make room for `--template` -- the obvious repair -- is worse. `gh` only consults a template when it is running interactively; without a body a non-TTY caller gets must provide `--title` and `--body` (or `--fill` ...) when not running interactively and no pull request at all. That would trade a broken flag for a command broken in CI, scripts, and agents. Handing `gh` a temporary file that already contains the template fails the same way, because the problem is the missing `--body`, not the file's contents. So the template is read here and folded into the body we already send, with the issue URL appended after it. The URL is what Linear matches on to attach the pull request to its issue, so it has to survive; putting it last leaves the template's prose as the first thing a reviewer reads. Every existing flag keeps working, because the argv shape is unchanged. Reading the file ourselves means we own its failures, and per CLAUDE.md an explicitly requested template that cannot be used is an error rather than a silent fallback to a URL-only body -- otherwise the user gets a pull request quietly missing the content they asked for. Missing paths, directories, non-regular files and unreadable files all produce a message naming the path. NUL bytes are rejected too: `Deno.readTextFile` does not refuse binary input, it substitutes U+FFFD and keeps the NULs, which `Deno.Command` then rejects with a bare TypeError that never mentions the file. One deliberate surface change: #266's description suggests `-T ""` to override a configured default. That worked only because an empty string happened to be falsy. It is now an explicit `--no-template` flag, and `-T ""` errors with a suggestion pointing at it. The generated skill docs under skills/ are left alone; they are produced from an installed binary out of band and are already stale on trunk.
Collaborator
|
Shipped in v2.6.0. Thanks for this —
#272 was a follow-up that fixed the mechanism so the template actually reaches GitHub — same flag letter, same config key, same precedence. |
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.
Note: You can use -T "" to override config default.