From 7aae24bb0ac04520980d164d397761a7047f5f1b Mon Sep 17 00:00:00 2001 From: Cody Guldner Date: Fri, 17 Jul 2026 14:14:13 -0500 Subject: [PATCH] Fix closed PR output lost in pipe subshell The pipe-to-while pattern runs the loop in a subshell, so the closed variable was always empty when written to GITHUB_OUTPUT. Use process substitution instead so the loop runs in the current shell. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/spec_update.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spec_update.yml b/.github/workflows/spec_update.yml index 369d8756..4522a512 100644 --- a/.github/workflows/spec_update.yml +++ b/.github/workflows/spec_update.yml @@ -90,12 +90,13 @@ jobs: if: steps.git-diff-num.outputs.num-diff != 0 run: | closed="" - gh pr list --label "automated-spec-update" --state open --json number --jq '.[].number' | while read -r pr_num; do + while read -r pr_num; do echo "Closing old PR #$pr_num" gh pr close "$pr_num" --delete-branch closed="${closed:+$closed,}$pr_num" - done + done < <(gh pr list --label "automated-spec-update" --state open --json number --jq '.[].number') echo "closed=$closed" >> "$GITHUB_OUTPUT" + shell: bash env: GH_TOKEN: ${{ steps.app-token.outputs.token }}