From 2587da51deae1bc087be09699a928a29522c7c7a Mon Sep 17 00:00:00 2001 From: mimo-3 Date: Sun, 12 Jul 2026 02:25:19 +0900 Subject: [PATCH] =?UTF-8?q?session-stop=E3=82=92close=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=80=81=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E9=A0=86=E5=BA=8F=E3=82=92=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/gh-attach | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/bin/gh-attach b/bin/gh-attach index d70cb8f..45a57b3 100755 --- a/bin/gh-attach +++ b/bin/gh-attach @@ -190,7 +190,7 @@ pw_stop() { if [[ -n "$keep_session" ]]; then return 0 fi - "${pw_cli[@]}" session-stop >/dev/null 2>&1 || true + "${pw_cli[@]}" close >/dev/null 2>&1 || true } if [[ -n "$body_file" ]]; then @@ -276,15 +276,8 @@ if [[ "$has_placeholder" == "false" ]]; then fi fi -# Create comment with placeholders (skipped in --url-only mode). -# In --url-only mode the caller posts their own comment with the returned URLs. -if [[ -z "$url_only" ]]; then - comment_info="$(gh api --hostname "$host" -X POST "repos/$repo/issues/$issue/comments" -f body="$body_with_placeholder" --jq '"\(.id)\t\(.html_url)"')" - comment_id="${comment_info%%$'\t'*}" - comment_url="${comment_info#*$'\t'}" -fi - -# Upload images +# Upload images (comment creation is deferred until after successful upload +# to avoid orphan placeholder comments when uploads fail). upload_urls=() if [[ -n "$use_release" ]]; then @@ -653,7 +646,7 @@ if [[ ${#images[@]} -ge 1 ]]; then body_with_images="${body_with_images//$placeholder_single/$first_img_tag}" fi -# Update the comment -gh api --hostname "$host" -X PATCH "repos/$repo/issues/comments/$comment_id" -f body="$body_with_images" >/dev/null +# Create the comment with final image tags (single POST, no orphan placeholders) +comment_url="$(gh api --hostname "$host" -X POST "repos/$repo/issues/$issue/comments" -f body="$body_with_images" --jq '.html_url')" -echo "Comment updated: $comment_url" +echo "Comment created: $comment_url"