Skip to content

Commit c747703

Browse files
committed
build: query the PR head SHA inside the job 💀
1 parent 7995b48 commit c747703

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/benchmark-pr.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,23 @@ jobs:
3333
PR_NUMBER: ${{ github.event.pull_request.number }}
3434
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
3535
steps:
36+
- name: Get PR head SHA
37+
if: ${{ github.event_name == 'pull_request' }}
38+
id: pr
39+
uses: actions/github-script@v7
40+
with:
41+
script: |
42+
const { data: pr } = await github.rest.pulls.get({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
pull_number: context.payload.pull_request.number,
46+
});
47+
core.setOutput("sha", pr.head.sha);core.setOutput("sha", pr.head.sha);
48+
3649
- name: Checkout and setup environment
3750
uses: MetaMask/action-checkout-and-setup@v1
3851
with:
39-
ref: ${{ inputs.pr-head-sha }}
52+
ref: ${{ steps.pr.outputs.sha }}
4053
is-high-risk-environment: false
4154
skip-allow-scripts: true
4255
yarn-custom-url: ${{ vars.YARN_URL }}
@@ -60,7 +73,7 @@ jobs:
6073
OWNER: ${{ github.repository_owner }}
6174
REPOSITORY: ${{ github.event.repository.name }}
6275
PR_NUMBER: ${{ github.event.pull_request.number }}
63-
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
76+
GITHUB_SHA: ${{ steps.pr.outputs.sha }}
6477

6578
- name: Upload benchmark results
6679
if: github.ref == 'refs/heads/main'

0 commit comments

Comments
 (0)