Skip to content

Commit 799acdb

Browse files
justin808claude
andcommitted
Fix unbound variable error in ci-rerun-failures
Handle empty COMMANDS_TO_RUN array properly with set -u by temporarily disabling nounset when checking array length. Bug occurred when no local test equivalents were found for failed CI jobs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e215d2b commit 799acdb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bin/ci-rerun-failures

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ while IFS= read -r check; do
184184
done
185185
done <<< "$FAILED_CHECKS"
186186

187-
if [ ${#COMMANDS_TO_RUN[@]} -eq 0 ]; then
187+
# Check if any commands were found (handle empty array with set -u)
188+
set +u
189+
NUM_COMMANDS=${#COMMANDS_TO_RUN[@]}
190+
set -u
191+
192+
if [ "$NUM_COMMANDS" -eq 0 ]; then
188193
echo -e "${YELLOW}No local equivalents found for failed jobs.${NC}"
189194
echo "Failed jobs might be from Pro or other workflows."
190195
echo ""

0 commit comments

Comments
 (0)