From b57584f890801680b7233bfbbb3898228ffa6588 Mon Sep 17 00:00:00 2001 From: Millian Lamiaux Date: Sat, 4 Jul 2026 18:59:21 +0200 Subject: [PATCH] fix(ci): wrap deploy commands in if blocks for -e protection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bash -e doesn't just kill on pipefail — it exits on ANY non-zero command. Even without a pipeline, both xcrun devicectl and ios-deploy return non-zero on failure, killing the script before the exit-code check. Fix: wrap both in 'if command; then exit 0; fi' so -e treats them as condition-tested (no early exit). Fallback now actually runs. --- .github/workflows/pr-iphone-deploy.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-iphone-deploy.yml b/.github/workflows/pr-iphone-deploy.yml index 61531e1..d7b6b42 100644 --- a/.github/workflows/pr-iphone-deploy.yml +++ b/.github/workflows/pr-iphone-deploy.yml @@ -106,18 +106,15 @@ jobs: # 1. Try WiFi first (Xcode 15+ devicectl network discovery) echo "📱 Trying WiFi install via devicectl..." - xcrun devicectl device install app --device "$UDID" "$APP" > /tmp/devicectl.log 2>&1 - DEVICECTL_EXIT=$? - tail -10 /tmp/devicectl.log - if [ $DEVICECTL_EXIT -eq 0 ]; then + if xcrun devicectl device install app --device "$UDID" "$APP" > /tmp/devicectl.log 2>&1; then echo "✅ Installed via WiFi" exit 0 fi + tail -10 /tmp/devicectl.log # 2. Fallback to USB via ios-deploy echo "🔌 WiFi failed, trying USB..." - ios-deploy --bundle "$APP" --id "$UDID" --justlaunch - if [ $? -eq 0 ]; then + if ios-deploy --bundle "$APP" --id "$UDID" --justlaunch; then echo "✅ Installed via USB" exit 0 fi @@ -125,6 +122,7 @@ jobs: echo "❌ Install failed (both WiFi and USB)" exit 1 + - name: Post "Ready to test" comment env: GT_TOKEN: ${{ secrets.PR_API_TOKEN }}