Skip to content

Commit 1aad2ef

Browse files
Subagent 5ampagent
andcommitted
fix: use merge-multiple for snapshot artifact download
The v4→v7 upgrade of download-artifact changed behavior: when a pattern matches only one artifact, files extract directly to path/ without the artifact name subdirectory. This broke the merge loop which expected snapshots-shard-*/ directories. Using merge-multiple: true is the documented pattern for sharded artifacts and eliminates directory structure assumptions. Amp-Thread-ID: https://ampcode.com/threads/T-019c0b70-122a-709b-a4f6-4929ed6ff3c2 Co-authored-by: Amp <amp@ampcode.com>
1 parent af8433f commit 1aad2ef

1 file changed

Lines changed: 19 additions & 27 deletions

File tree

.github/workflows/pr-update-playwright-expectations.yaml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180
with:
181181
pattern: snapshots-shard-*
182182
path: ./downloaded-snapshots
183-
merge-multiple: false
183+
merge-multiple: true
184184

185185
- name: List downloaded files
186186
run: |
@@ -206,13 +206,13 @@ jobs:
206206
echo "MERGING CHANGED SNAPSHOTS"
207207
echo "=========================================="
208208
209-
# Check if any artifacts were downloaded
209+
# Check if any artifacts were downloaded (merge-multiple puts files directly in path)
210210
if [ ! -d "./downloaded-snapshots" ]; then
211211
echo "No snapshot artifacts to merge"
212212
echo "=========================================="
213213
echo "MERGE COMPLETE"
214214
echo "=========================================="
215-
echo "Shards merged: 0"
215+
echo "Files merged: 0"
216216
exit 0
217217
fi
218218
@@ -222,37 +222,29 @@ jobs:
222222
exit 1
223223
fi
224224
225-
merged_count=0
225+
# Count files to merge
226+
file_count=$(find ./downloaded-snapshots -type f | wc -l)
226227
227-
# For each shard's changed files, copy them directly
228-
for shard_dir in ./downloaded-snapshots/snapshots-shard-*/; do
229-
if [ ! -d "$shard_dir" ]; then
230-
continue
231-
fi
232-
233-
shard_name=$(basename "$shard_dir")
234-
file_count=$(find "$shard_dir" -type f | wc -l)
235-
236-
if [ "$file_count" -eq 0 ]; then
237-
echo " $shard_name: no files"
238-
continue
239-
fi
240-
241-
echo "Processing $shard_name ($file_count file(s))..."
228+
if [ "$file_count" -eq 0 ]; then
229+
echo "No snapshot files found in downloaded artifacts"
230+
echo "=========================================="
231+
echo "MERGE COMPLETE"
232+
echo "=========================================="
233+
echo "Files merged: 0"
234+
exit 0
235+
fi
242236
243-
# Copy files directly, preserving directory structure
244-
# Since files are already in correct structure (no browser_tests/ prefix), just copy them all
245-
cp -v -r "$shard_dir"* browser_tests/ 2>&1 | sed 's/^/ /'
237+
echo "Merging $file_count snapshot file(s)..."
246238
247-
merged_count=$((merged_count + 1))
248-
echo " ✓ Merged"
249-
echo ""
250-
done
239+
# Copy all files directly, preserving directory structure
240+
# With merge-multiple: true, files are directly in ./downloaded-snapshots/ without shard subdirs
241+
cp -v -r ./downloaded-snapshots/* browser_tests/ 2>&1 | sed 's/^/ /'
251242
243+
echo ""
252244
echo "=========================================="
253245
echo "MERGE COMPLETE"
254246
echo "=========================================="
255-
echo "Shards merged: $merged_count"
247+
echo "Files merged: $file_count"
256248
257249
- name: Show changes
258250
run: |

0 commit comments

Comments
 (0)