From a3df424857ace2c224801829b1c9d7ceac6ee8c3 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Wed, 7 Jan 2026 07:57:56 -0800 Subject: [PATCH] fix: validate that issues exist before commenting on duplicates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add validation to comment-on-duplicates.sh that verifies the base issue and all potential duplicate issues actually exist in the repo before posting a comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- scripts/comment-on-duplicates.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/comment-on-duplicates.sh b/scripts/comment-on-duplicates.sh index 3a057203..59577af3 100755 --- a/scripts/comment-on-duplicates.sh +++ b/scripts/comment-on-duplicates.sh @@ -60,6 +60,20 @@ for dup in "${DUPLICATES[@]}"; do fi done +# Validate that base issue exists +if ! gh issue view "$BASE_ISSUE" --repo "$REPO" &>/dev/null; then + echo "Error: issue #$BASE_ISSUE does not exist in $REPO" >&2 + exit 1 +fi + +# Validate that all duplicate issues exist +for dup in "${DUPLICATES[@]}"; do + if ! gh issue view "$dup" --repo "$REPO" &>/dev/null; then + echo "Error: issue #$dup does not exist in $REPO" >&2 + exit 1 + fi +done + # Build comment body COUNT=${#DUPLICATES[@]} if [[ $COUNT -eq 1 ]]; then