hive-forge: issue-create refuses an empty body

This commit is contained in:
damocles 2026-08-19 01:38:39 +02:00 committed by mara
commit 3c4ff447e3

View file

@ -34,12 +34,20 @@ pub struct Args {
/// # Errors
///
/// Propagates any I/O error from the body input (`--body-file`,
/// stdin), any transport error from the Forgejo REST call (network
/// unreachable, 4xx/5xx response, token missing/invalid, the
/// `--label` lookup's own list-labels call), an unresolved `--label`
/// name, and any I/O error from writing the issue URL to stdout.
/// stdin), an absent or whitespace-only body (an issue's body *is*
/// the issue per this repo's contribution guidance — an empty one is
/// never intentional, only ever the signature of a mistake upstream,
/// e.g. a heredoc that bound to the wrong command in a pipeline), any
/// transport error from the Forgejo REST call (network unreachable,
/// 4xx/5xx response, token missing/invalid, the `--label` lookup's
/// own list-labels call), an unresolved `--label` name, and any I/O
/// error from writing the issue URL to stdout.
pub fn run(client: &Client, args: Args) -> Result<()> {
let body = body::resolve(args.body.as_deref(), args.body_file.as_deref())?.unwrap_or_default();
let body = body::resolve_required(
args.body.as_deref(),
args.body_file.as_deref(),
"issue-create",
)?;
let (owner, name) = client.owner_repo()?;
let label_ids = if args.labels.is_empty() {
None