diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6570d6a70a39e5debb724df7c80b840e163cdd00..10472015fa9d42b6606bb68ba7be0a6ba6b78d78 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -44,6 +44,7 @@ jobs:
       os-matrix-prefetch: ${{ steps.os-matrix-prefetch.outputs.matrix }}
       test-shards: ${{ steps.test-shards.outputs.test-shards }}
       test-shards-all: ${{ steps.test-shards.outputs.test-shards-all }}
+      commit-sha: ${{ steps.commit-sha.outputs.commit-sha }}
 
     env:
       # Field required for GitHub CLI
@@ -92,6 +93,11 @@ jobs:
         with:
           sparse-checkout: ${{ env.SPARSE_CHECKOUT }}
 
+      - name: Detect commit SHA
+        id: commit-sha
+        run: |
+          echo "commit-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
+
       - name: Calculate `yarn-lock-hash` output
         id: yarn-lock-hash
         run: |