Skip to content

Commit 5bbbb31

Browse files
cguldnerclaude
andauthored
Fix closed PR output lost in pipe subshell (#555)
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 <noreply@anthropic.com>
1 parent 0d61908 commit 5bbbb31

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/spec_update.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ jobs:
9090
if: steps.git-diff-num.outputs.num-diff != 0
9191
run: |
9292
closed=""
93-
gh pr list --label "automated-spec-update" --state open --json number --jq '.[].number' | while read -r pr_num; do
93+
while read -r pr_num; do
9494
echo "Closing old PR #$pr_num"
9595
gh pr close "$pr_num" --delete-branch
9696
closed="${closed:+$closed,}$pr_num"
97-
done
97+
done < <(gh pr list --label "automated-spec-update" --state open --json number --jq '.[].number')
9898
echo "closed=$closed" >> "$GITHUB_OUTPUT"
99+
shell: bash
99100
env:
100101
GH_TOKEN: ${{ steps.app-token.outputs.token }}
101102

0 commit comments

Comments
 (0)