Fix COMMIT_SHA when generating PR artifacts (#32647)
Follow-up to #31850. We want to build using the original commit SHA, not the merge commit that GitHub Actions creates behind the scenes. We were already checking out the correct commit object, but the COMMIT_SHA artifact was still pointing to the merge commit. This should fix the sizebot links to point to working URLs, too.
Andrew Clark committed
Mar 17, 2025 at 12:46 UTC
9320a0139df876509c8ebb6f6fd950a6690bd5d9
1 file changed
+2
-2
.github/workflows/runtime_build_and_test.yml
+2
-2
@@ -330,7 +330,7 @@ jobs:
330
merge-multiple: true
331
- name: Display structure of build
332
run: ls -R build
333
- - run: echo ${{ github.sha }} >> build/COMMIT_SHA
333
+ - run: echo ${{ github.event.pull_request.head.sha || github.sha }} >> build/COMMIT_SHA
334
- name: Scrape warning messages
335
run: |
336
mkdir -p ./build/__test_utils__
@@ -664,7 +664,7 @@ jobs:
664
node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js
665
- name: Display structure of build for PR
666
run: ls -R build
667
- - run: echo ${{ github.sha }} >> build/COMMIT_SHA
667
+ - run: echo ${{ github.event.pull_request.head.sha || github.sha }} >> build/COMMIT_SHA
668
- run: node ./scripts/tasks/danger
669
- name: Archive sizebot results
670
uses: actions/upload-artifact@v4