hive-forge: add --milestone to issue-edit

This commit is contained in:
damocles 2026-05-22 20:31:13 +02:00
parent 66ec8390e1
commit 93bf91535f

View file

@ -300,17 +300,18 @@ pkgs.writeShellApplication {
}
cmd_issue_edit() {
# issue-edit <number> [--title <title>] [--body <body>] [--state open|closed] [repo]
# Edit an issue's title, body, or state. Only provided fields are changed.
if [ $# -lt 1 ]; then echo "usage: hive-forge issue-edit <number> [--title <title>] [--body <body>] [--state open|closed] [repo]" >&2; exit 1; fi
# issue-edit <number> [--title <title>] [--body <body>] [--state open|closed] [--milestone <id>] [repo]
# Edit an issue's title, body, state, or milestone. Only provided fields are changed.
if [ $# -lt 1 ]; then echo "usage: hive-forge issue-edit <number> [--title <title>] [--body <body>] [--state open|closed] [--milestone <id>] [repo]" >&2; exit 1; fi
local _n="$1"; shift
local _title="" _body="" _state="" _repo="$HIVE_FORGE_REPO"
local _title="" _body="" _state="" _milestone="" _repo="$HIVE_FORGE_REPO"
while [ $# -gt 0 ]; do
case "$1" in
--title) _title="$2"; shift 2 ;;
--body) _body="$2"; shift 2 ;;
--state) _state="$2"; shift 2 ;;
*) _repo="$1"; shift ;;
--title) _title="$2"; shift 2 ;;
--body) _body="$2"; shift 2 ;;
--state) _state="$2"; shift 2 ;;
--milestone) _milestone="$2"; shift 2 ;;
*) _repo="$1"; shift ;;
esac
done
local _payload
@ -318,12 +319,14 @@ pkgs.writeShellApplication {
--arg title "$_title" \
--arg body "$_body" \
--arg state "$_state" \
--argjson milestone "$([ -n "$_milestone" ] && echo "$_milestone" || echo "null")" \
'{} |
if $title != "" then . + {title:$title} else . end |
if $body != "" then . + {body:$body} else . end |
if $state != "" then . + {state:$state} else . end')
if $title != "" then . + {title:$title} else . end |
if $body != "" then . + {body:$body} else . end |
if $state != "" then . + {state:$state} else . end |
if $milestone != null then . + {milestone:$milestone} else . end')
forge_patch "$FORGE_API/repos/$_repo/issues/$_n" "$_payload" \
| jq '{number,title,state}'
| jq '{number,title,state,milestone:.milestone.title}'
}
cmd_attach_issue() {