From 1f82cdf05416f81720940bd402878062998a8efb Mon Sep 17 00:00:00 2001
From: Alexey Kureev <a.g.kureev@gmail.com>
Date: Mon, 17 Nov 2025 20:18:49 +0100
Subject: [PATCH 1/4] fix: adapt elf workflow to remote rock build

---
 .github/workflows/remote-build-android.yml | 29 +++++++++++-----------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/remote-build-android.yml b/.github/workflows/remote-build-android.yml
index 0b99f89eb50c..2d0bf91b131f 100644
--- a/.github/workflows/remote-build-android.yml
+++ b/.github/workflows/remote-build-android.yml
@@ -48,21 +48,22 @@ jobs:
           git checkout pr-${{ github.event.inputs.mobile_expensify_pr }}
           echo "Checked out Mobile-Expensify PR #${{ github.event.inputs.mobile_expensify_pr }}"
           
-      - name: Rock Remote Build - Android
-        # rock v3
-        uses: callstackincubator/android@1a7d52dfe3ca195ccbe5ad2f06c15f2fc3835115
-        env:
-          GITHUB_ACTOR: ${{ github.actor }}
-          GITHUB_TOKEN: ${{ github.token }}
-          IS_HYBRID_APP: ${{ matrix.is_hybrid_build }}
-        with:
-          variant: ${{ matrix.variant }}
-          rock-build-extra-params: '--extra-params -PreactNativeArchitectures=arm64-v8a,x86_64'
-          comment-bot: false
+      - name: Download Rock artifact
+        run: |
+          echo "Downloading artifact from: $ARTIFACT_URL"
+          curl -L "$ARTIFACT_URL" -o artifact.zip
+          unzip artifact.zip -d artifact_contents
 
-      - name: Verify ELF alignment
+      - name: Find APK
         run: |
-          APK_PATH=$(find android/app/build/outputs/apk -type f -name "*.apk" | head -n 1)
-          echo "Using APK: $APK_PATH"
+          APK=$(find artifact_contents -type f -name "*.apk" | head -n 1)
+          if [ -z "$APK" ]; then
+            echo "No APK found in artifact"
+            exit 1
+          fi
+          echo "APK_PATH=$APK" >> $GITHUB_ENV
+          echo "Using APK: $APK"
 
+      - name: Verify ELF alignment
+        run: |
           scripts/check-elf-alignment.sh "$APK_PATH"

From 5086bee439078a940f0fc1725cc6c501299214dc Mon Sep 17 00:00:00 2001
From: Alexey Kureev <a.g.kureev@gmail.com>
Date: Mon, 17 Nov 2025 20:55:02 +0100
Subject: [PATCH 2/4] fix: revert remote build removal

---
 .github/workflows/remote-build-android.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.github/workflows/remote-build-android.yml b/.github/workflows/remote-build-android.yml
index 2d0bf91b131f..d7e66dc64d07 100644
--- a/.github/workflows/remote-build-android.yml
+++ b/.github/workflows/remote-build-android.yml
@@ -48,6 +48,18 @@ jobs:
           git checkout pr-${{ github.event.inputs.mobile_expensify_pr }}
           echo "Checked out Mobile-Expensify PR #${{ github.event.inputs.mobile_expensify_pr }}"
           
+      - name: Rock Remote Build - Android
+        # rock v3
+        uses: callstackincubator/android@1a7d52dfe3ca195ccbe5ad2f06c15f2fc3835115
+        env:
+          GITHUB_ACTOR: ${{ github.actor }}
+          GITHUB_TOKEN: ${{ github.token }}
+          IS_HYBRID_APP: ${{ matrix.is_hybrid_build }}
+        with:
+          variant: ${{ matrix.variant }}
+          rock-build-extra-params: '--extra-params -PreactNativeArchitectures=arm64-v8a,x86_64'
+          comment-bot: false
+
       - name: Download Rock artifact
         run: |
           echo "Downloading artifact from: $ARTIFACT_URL"

From ddcc94a1b4f309acd07dd6bfc5d5664918cabb96 Mon Sep 17 00:00:00 2001
From: Alexey Kureev <a.g.kureev@gmail.com>
Date: Wed, 19 Nov 2025 02:49:43 +0100
Subject: [PATCH 3/4] fix: missing quotes around var

---
 .github/workflows/remote-build-android.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/remote-build-android.yml b/.github/workflows/remote-build-android.yml
index d7e66dc64d07..8b05eace8977 100644
--- a/.github/workflows/remote-build-android.yml
+++ b/.github/workflows/remote-build-android.yml
@@ -73,7 +73,7 @@ jobs:
             echo "No APK found in artifact"
             exit 1
           fi
-          echo "APK_PATH=$APK" >> $GITHUB_ENV
+          echo "APK_PATH=$APK" >> "$GITHUB_ENV"
           echo "Using APK: $APK"
 
       - name: Verify ELF alignment

From 525f551a4fce797ca29c29265f46b61a73267146 Mon Sep 17 00:00:00 2001
From: Alexey Kureev <a.g.kureev@gmail.com>
Date: Wed, 19 Nov 2025 14:57:42 +0100
Subject: [PATCH 4/4] fix: add auth headers

---
 .github/workflows/remote-build-android.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/remote-build-android.yml b/.github/workflows/remote-build-android.yml
index 8b05eace8977..837cbb55e3f2 100644
--- a/.github/workflows/remote-build-android.yml
+++ b/.github/workflows/remote-build-android.yml
@@ -61,9 +61,15 @@ jobs:
           comment-bot: false
 
       - name: Download Rock artifact
+        env:
+          ARTIFACT_URL: ${{ env.ARTIFACT_URL }}
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
           echo "Downloading artifact from: $ARTIFACT_URL"
-          curl -L "$ARTIFACT_URL" -o artifact.zip
+          curl -L \
+            -H "Authorization: Bearer $GITHUB_TOKEN" \
+            -H "Accept: application/octet-stream" \
+            "$ARTIFACT_URL" -o artifact.zip
           unzip artifact.zip -d artifact_contents
 
       - name: Find APK
