Skip to content

Commit 2e8fd91

Browse files
committed
ci: ensure the shas used by compare match the current PR
1 parent e5391b6 commit 2e8fd91

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/development.yml

+31
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,45 @@ jobs:
6767
experimental: ${{ matrix.experimental }}
6868
secrets: inherit
6969

70+
# -------------------------------------------------------------
71+
# Get the NX-blessed base and head shas.
72+
# --------------------------------------------------------------
73+
get-shas:
74+
runs-on: ubuntu-latest
75+
name: Get SHA values
76+
outputs:
77+
base-sha: ${{ steps.set-SHAs.outputs.base }}
78+
head-sha: ${{ steps.set-SHAs.outputs.head }}
79+
permissions:
80+
pull-requests: read
81+
steps:
82+
- name: Check out code
83+
uses: actions/checkout@v4
84+
with:
85+
fetch-depth: 0
86+
87+
- name: Use Node LTS version
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 18
91+
cache: yarn
92+
93+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
94+
id: set-SHAs
95+
uses: nrwl/nx-set-shas@v3
96+
7097
# -------------------------------------------------------------
7198
# Compare the compiled assets
7299
# -------------------------------------------------------------
73100
compare:
74101
name: Compare
102+
needs: [get-shas]
75103
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
76104
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
77105
uses: ./.github/workflows/compare-results.yml
106+
with:
107+
base-sha: ${{ needs.get-shas.outputs.base-sha }}
108+
head-sha: ${{ needs.get-shas.outputs.head-sha }}
78109
secrets: inherit
79110

80111
# -------------------------------------------------------------

0 commit comments

Comments
 (0)