From 834b2d494da0f5bd2041a33eed28ec1ba2939d77 Mon Sep 17 00:00:00 2001 From: Norair Arutshyan Date: Wed, 30 Sep 2026 14:39:51 +0100 Subject: [PATCH] fix(workflow): check exit code, not emptiness, for parent-issue lookup (#370) gh api --jq writes the raw error body to stdout on a failed request, not just stderr, so `parent=$(gh api ... || echo "")` still captured that body once the request failed. It then got used as a URL path segment in the next gh api call and broke. Confirmed live: PR #369's own merge run closed #368, then crashed exactly this way since #368 has no parent. Check the command's own exit status instead of trusting the string. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/close-linked-issues.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/close-linked-issues.yml b/.github/workflows/close-linked-issues.yml index 7497f04..0a02223 100644 --- a/.github/workflows/close-linked-issues.yml +++ b/.github/workflows/close-linked-issues.yml @@ -33,8 +33,8 @@ jobs: gh issue close "$issue" --repo "$REPO" --reason completed # A GitHub sub-issue relationship, not this repo's tasks.md — survives archiving. - parent=$(gh api "repos/$REPO/issues/$issue/parent" --jq '.number' 2>/dev/null || echo "") - if [[ -z "$parent" ]]; then + # A failed lookup writes its error body to stdout too, so check the exit code. + if ! parent=$(gh api "repos/$REPO/issues/$issue/parent" --jq '.number' 2>/dev/null); then echo "issue #$issue has no parent" exit 0 fi