From 84ccda74a3f599111dd7f2e0bc099b93a1428293 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 22 Jan 2026 01:20:03 +0000 Subject: [PATCH 1/2] fix: ensure PR builds use actual PR head commit, not merge commit - Add ref parameter to all checkout steps to use PR head SHA - Update comment-pr job to display correct commit SHA with clickable link - Update sign job artifact naming to use PR head SHA for PR builds - Falls back to github.sha for tags and branch pushes (no change in behavior) This fixes an issue where: 1. Builds were done on the merge commit instead of actual PR commit 2. The SHA commented on PRs was the merge commit, not the PR head 3. Clicking the commit link showed a weird merge commit, especially after rebasing Co-authored-by: wharris --- .github/workflows/actions.yml | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 3d473162..61053bd7 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -60,6 +60,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 sparse-checkout: | android/app/src/main/res/menu/main.xml @@ -89,6 +91,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 - name: ccache @@ -213,6 +217,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 # Import build variables from build job @@ -300,10 +306,10 @@ jobs: VERSION=${GITHUB_REF#refs/tags/v} SUFFIX="-${VERSION}" elif [[ $GITHUB_REF == refs/pull/* ]]; then - # For pull requests + # For pull requests - use actual PR head SHA, not merge commit SHA PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') BRANCH_NAME=$(sanitize_branch_name "$GITHUB_HEAD_REF") - SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7) + SHORT_SHA=$(echo $PR_HEAD_SHA | cut -c1-7) SUFFIX="-pr-${PR_NUMBER}-${BRANCH_NAME}-${SHORT_SHA}" else # For pushes to branches other than main @@ -311,6 +317,9 @@ jobs: SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7) SUFFIX="-${BRANCH_NAME}-${SHORT_SHA}" fi + env: + # For PRs, this is the actual PR head commit; for other events it's empty (not used) + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} # Find and rename signed debug APKs find signing/apk/debug/ -name "*-signed.apk" | while read apk; do @@ -362,11 +371,15 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} script: | const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; + // Use the actual PR head commit SHA, not the merge commit SHA + const commitSha = context.payload.pull_request.head.sha; + const shortSha = commitSha.substring(0, 7); + const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${commitSha}`; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `Build artifacts for PR #${context.issue.number} (commit ${context.sha}) are available: + body: `Build artifacts for PR #${context.issue.number} (commit [\`${shortSha}\`](${commitUrl})) are available: - [Debug APKs (arm64-v8a, x86_64)](${workflowUrl}#artifacts) - [Release APKs (arm64-v8a, x86_64)](${workflowUrl}#artifacts) @@ -387,6 +400,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 - name: ccache @@ -518,6 +533,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 # Execute the common setup with emulator configuration @@ -722,6 +739,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 # Execute minimal setup for running pre-built APKs on emulator @@ -869,6 +888,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 # Fail early if any integration test shard failed (prevents release with broken tests) @@ -965,6 +986,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For PRs, checkout the actual PR head commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 1 # Download coverage results from both unit and integration tests @@ -1044,6 +1067,8 @@ jobs: steps: - uses: actions/checkout@v3 with: + # For tags this is a no-op (falls back to github.sha), but consistent pattern + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 0 - name: Download all artifacts From 80b049360a19f50c2e825ac6bd2f305c448542b5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 22 Jan 2026 01:36:34 +0000 Subject: [PATCH 2/2] fix: correct YAML syntax - move env block after run script Co-authored-by: wharris --- .github/workflows/actions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 61053bd7..daafdacf 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -317,9 +317,6 @@ jobs: SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7) SUFFIX="-${BRANCH_NAME}-${SHORT_SHA}" fi - env: - # For PRs, this is the actual PR head commit; for other events it's empty (not used) - PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} # Find and rename signed debug APKs find signing/apk/debug/ -name "*-signed.apk" | while read apk; do @@ -339,6 +336,9 @@ jobs: # List all renamed files echo "Renamed files:" ls -la renamed_apks/ + env: + # For PRs, this is the actual PR head commit; for other events it's empty (not used) + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} # Upload signed artifacts - name: Upload SIGNED APK Debug