Skip to content

Commit af70a43

Browse files
authored
Improve handling of changed workspaces in Playwright CI
Enhanced the workflow to handle raw output and avoid issues with carriage returns when building changed workspaces.
1 parent 674c33b commit af70a43

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

.github/workflows/playwright.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,27 @@ jobs:
9191

9292
- name: Build Changed Workspaces
9393
run: |
94-
IFS=$'\n'
95-
CHANGED_WORKSPACES_ARRAY=(${{ steps.get_workspaces.outputs.changed_workspaces }})
96-
echo "Changed Workspaces Array: ${CHANGED_WORKSPACES_ARRAY[@]}"
97-
98-
echo "Building changed workspaces:"
94+
# Read the workflow output into a variable
95+
raw="${{ steps.get_workspaces.outputs.changed_workspaces }}"
96+
97+
# Show the raw output with visible line endings to catch CR (\r) or other odd chars
98+
printf '<<RAW OUTPUT (visible endings)>>\n'
99+
printf '%s' "$raw" | sed -n 'l'
100+
printf '<<END RAW OUTPUT>>\n'
101+
102+
# Remove any stray carriage returns that can cause truncation or strange splitting
103+
raw="${raw//$'\r'/}"
104+
105+
# Use mapfile/readarray to split by newline reliably into an array
106+
mapfile -t CHANGED_WORKSPACES_ARRAY <<< "$raw"
107+
108+
echo "Changed Workspaces Array (${#CHANGED_WORKSPACES_ARRAY[@]} items):"
99109
for workspace in "${CHANGED_WORKSPACES_ARRAY[@]}"; do
110+
# skip any empty entries
111+
if [ -z "$workspace" ]; then
112+
continue
113+
fi
114+
100115
echo " - samples/$workspace"
101116
npm run build --workspace=samples/$workspace
102117
done

0 commit comments

Comments
 (0)