Skip to content

Commit 92bacbe

Browse files
owineclaude
andcommitted
fix(scripts): resolve shellcheck SC2129 warnings in detect-stack-changes.sh
Group multiple echo statements with single redirect to improve efficiency and satisfy shellcheck SC2129 style warnings. Changed: - Multiple `echo >> file` → `{ echo; echo; } >> file` - Applies to both first deployment and normal output sections - More efficient I/O with single file open Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent 0c27edf commit 92bacbe

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

scripts/deployment/detect-stack-changes.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ if [ "$CURRENT_SHA" = "unknown" ]; then
7171

7272
# All input stacks are new, no removed or existing stacks
7373
if [ -n "${GITHUB_OUTPUT:-}" ]; then
74-
echo "removed_stacks=[]" >> "$GITHUB_OUTPUT"
75-
echo "existing_stacks=[]" >> "$GITHUB_OUTPUT"
76-
echo "new_stacks=$INPUT_STACKS" >> "$GITHUB_OUTPUT"
77-
echo "has_removed_stacks=false" >> "$GITHUB_OUTPUT"
78-
echo "has_existing_stacks=false" >> "$GITHUB_OUTPUT"
79-
echo "has_new_stacks=true" >> "$GITHUB_OUTPUT"
74+
{
75+
echo "removed_stacks=[]"
76+
echo "existing_stacks=[]"
77+
echo "new_stacks=$INPUT_STACKS"
78+
echo "has_removed_stacks=false"
79+
echo "has_existing_stacks=false"
80+
echo "has_new_stacks=true"
81+
} >> "$GITHUB_OUTPUT"
8082
fi
8183
exit 0
8284
fi
@@ -454,12 +456,14 @@ NEW_JSON=$(if [ -n "$NEW_STACKS" ]; then echo "$NEW_STACKS" | jq -R -s -c 'split
454456
455457
# Output results
456458
if [ -n "${GITHUB_OUTPUT:-}" ]; then
457-
echo "removed_stacks=$REMOVED_JSON" >> "$GITHUB_OUTPUT"
458-
echo "existing_stacks=$EXISTING_JSON" >> "$GITHUB_OUTPUT"
459-
echo "new_stacks=$NEW_JSON" >> "$GITHUB_OUTPUT"
460-
echo "has_removed_stacks=$([ -n "$REMOVED_STACKS" ] && echo "true" || echo "false")" >> "$GITHUB_OUTPUT"
461-
echo "has_existing_stacks=$([ -n "$EXISTING_STACKS" ] && echo "true" || echo "false")" >> "$GITHUB_OUTPUT"
462-
echo "has_new_stacks=$([ -n "$NEW_STACKS" ] && echo "true" || echo "false")" >> "$GITHUB_OUTPUT"
459+
{
460+
echo "removed_stacks=$REMOVED_JSON"
461+
echo "existing_stacks=$EXISTING_JSON"
462+
echo "new_stacks=$NEW_JSON"
463+
echo "has_removed_stacks=$([ -n "$REMOVED_STACKS" ] && echo "true" || echo "false")"
464+
echo "has_existing_stacks=$([ -n "$EXISTING_STACKS" ] && echo "true" || echo "false")"
465+
echo "has_new_stacks=$([ -n "$NEW_STACKS" ] && echo "true" || echo "false")"
466+
} >> "$GITHUB_OUTPUT"
463467
fi
464468
465469
# Cleanup removed stacks if any

0 commit comments

Comments
 (0)