Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/wearos-emulator-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,18 @@ jobs:
return 1
}

open_deep_link() {
local url="$1"

adb -s "$emulator_serial" shell am force-stop "$BUNDLE_ID" >/dev/null 2>&1 || true

if adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "$url" "$BUNDLE_ID" >/dev/null 2>&1 </dev/null; then
return 0
fi

adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function runs under set -euo pipefail. If the fallback adb ... am start on the last line fails, Bash may exit the entire step before open_deep_link can return a non-zero status to the caller (so the loop won't reach the ::warning::Failed to open deep link path). Consider guarding the final start with || return 1 (or temporarily disabling set -e within the function) so failures are handled via the caller's if open_deep_link ...; then ... else ... logic.

Suggested change
adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null
adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null || return 1

Copilot uses AI. Check for mistakes.
}

shots_dir="$GITHUB_WORKSPACE/artifacts/screenshots"
mkdir -p "$shots_dir"
printf "index,url,file\n" > "$shots_dir/manifest.csv"
Expand Down Expand Up @@ -510,7 +522,7 @@ jobs:
fi
filename="$(printf '%02d' "$index")-$slug.png"

if adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null; then
if open_deep_link "$url"; then
if ! wait_for_app_foreground "$BUNDLE_ID"; then
echo "::warning::Deep link opened but app is not foregrounded: $url"
index=$((index + 1))
Expand Down