hive-forge: reject empty/whitespace-only comment bodies (closes #297, closes #299)

This commit is contained in:
damocles 2026-05-22 23:31:14 +02:00 committed by Mara
parent 631356f2f8
commit dd3a820e57

View file

@ -148,6 +148,9 @@ pkgs.writeShellApplication {
else else
_body="$*" _body="$*"
fi fi
if [ -z "$(printf '%s' "$_body" | tr -d '[:space:]')" ]; then
echo "hive-forge comment: refusing to post empty comment body" >&2; exit 1
fi
local _payload local _payload
_payload=$(jq -n --arg body "$_body" '{body:$body}') _payload=$(jq -n --arg body "$_body" '{body:$body}')
forge_post "$FORGE_API/repos/$_repo/issues/$_n/comments" "$_payload" \ forge_post "$FORGE_API/repos/$_repo/issues/$_n/comments" "$_payload" \
@ -174,6 +177,9 @@ pkgs.writeShellApplication {
_body="$1"; shift _body="$1"; shift
if [ $# -gt 0 ]; then _repo="$1"; fi if [ $# -gt 0 ]; then _repo="$1"; fi
fi fi
if [ -z "$(printf '%s' "$_body" | tr -d '[:space:]')" ]; then
echo "hive-forge comment-edit: refusing to post empty comment body" >&2; exit 1
fi
local _payload local _payload
_payload=$(jq -n --arg body "$_body" '{body:$body}') _payload=$(jq -n --arg body "$_body" '{body:$body}')
forge_patch "$FORGE_API/repos/$_repo/issues/comments/$_id" "$_payload" \ forge_patch "$FORGE_API/repos/$_repo/issues/comments/$_id" "$_payload" \