Skip to content

Commit 2338b52

Browse files
authored
fix: resolve second subshell issue in image-only validation (#16)
## Problem Found a second subshell issue in the `validate-image-only-changed` step that was causing the same false failure problem. ## Root Cause The loop checking if only image field changed also used a pipe pattern: ```bash echo "$CHANGED_FILES" | jq -r '.[]' | while IFS= read -r file; do # validation code that writes to /tmp files done ``` This creates a subshell where file writes don't persist after the loop. ## Solution Applied the same process substitution fix: ```bash while IFS= read -r file; do # validation code done < <(echo "$CHANGED_FILES" | jq -r '.[]') ``` ## Testing This will be validated with PR #362 in deutschebank-infrastructure repository. ## Related - Fixes same issue as #15 - Required for dotCMS/deutschebank-infrastructure#362
1 parent a7bf57e commit 2338b52

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/deployment-guard.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ jobs:
286286
287287
BASE_SHA="${{ github.event.pull_request.base.sha }}"
288288
289-
echo "$CHANGED_FILES" | jq -r '.[]' | while IFS= read -r file; do
289+
# Use process substitution to avoid subshell issues with pipe
290+
while IFS= read -r file; do
290291
echo "=================================================="
291292
echo "Validating: $file"
292293
echo "=================================================="
@@ -330,7 +331,7 @@ jobs:
330331
echo "$OLD_IMAGE" >> /tmp/old_images.txt
331332
fi
332333
echo ""
333-
done
334+
done < <(echo "$CHANGED_FILES" | jq -r '.[]')
334335
335336
if [ -f /tmp/validation_failed.txt ]; then
336337
{

0 commit comments

Comments
 (0)