Skip to content

Commit 264df41

Browse files
author
Lalit Sharma
committed
patched both workflows to be macOS-portable
1 parent 5e73906 commit 264df41

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/android-emulator-screenshots.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,11 @@ jobs:
283283
avdmanager list device | awk '
284284
$1 == "id:" {
285285
id = "";
286-
if (match($0, /"([^"]+)"/, matches)) {
287-
id = matches[1];
286+
quoted_parts = split($0, parts, "\"");
287+
if (quoted_parts >= 2) {
288+
id = parts[2];
289+
} else {
290+
id = $2;
288291
}
289292
next;
290293
}
@@ -485,8 +488,7 @@ jobs:
485488
486489
if [ -n "$deep_links" ]; then
487490
index=1
488-
mapfile -t deep_link_list <<< "$deep_links"
489-
for url in "${deep_link_list[@]}"; do
491+
while IFS= read -r url; do
490492
[ -z "$url" ] && continue
491493
slug="$(printf '%s' "$url" | sed -E 's#^[a-zA-Z][a-zA-Z0-9+.-]*://##; s#[^A-Za-z0-9._-]+#-#g; s#-+#-#g; s#^-##; s#-$##')"
492494
if [ -z "$slug" ]; then
@@ -508,7 +510,9 @@ jobs:
508510
fi
509511
510512
index=$((index + 1))
511-
done
513+
done <<EOF
514+
$deep_links
515+
EOF
512516
fi
513517

514518
{

.github/workflows/wearos-emulator-screenshots.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ jobs:
278278
avdmanager list device | awk '
279279
$1 == "id:" {
280280
id = "";
281-
if (match($0, /"([^"]+)"/, matches)) {
282-
id = matches[1];
281+
quoted_parts = split($0, parts, "\"");
282+
if (quoted_parts >= 2) {
283+
id = parts[2];
284+
} else {
285+
id = $2;
283286
}
284287
next;
285288
}
@@ -465,8 +468,7 @@ jobs:
465468
466469
if [ -n "$deep_links" ]; then
467470
index=1
468-
mapfile -t deep_link_list <<< "$deep_links"
469-
for url in "${deep_link_list[@]}"; do
471+
while IFS= read -r url; do
470472
[ -z "$url" ] && continue
471473
slug="$(printf '%s' "$url" | sed -E 's#^[a-zA-Z][a-zA-Z0-9+.-]*://##; s#[^A-Za-z0-9._-]+#-#g; s#-+#-#g; s#^-##; s#-$##')"
472474
if [ -z "$slug" ]; then
@@ -488,7 +490,9 @@ jobs:
488490
fi
489491
490492
index=$((index + 1))
491-
done
493+
done <<EOF
494+
$deep_links
495+
EOF
492496
fi
493497

494498
{

0 commit comments

Comments
 (0)