Skip to content

Commit 2941b43

Browse files
committed
Make checkout ref conditional based on PR or Nightly.
1 parent 1d9dfd6 commit 2941b43

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/pr.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# We need a sufficient depth or Danger will occasionally run into issues checking which files were modified.
3535
fetch-depth: 100
3636
# This is dangerous without the member check
37-
ref: ${{ github.head_ref }}
37+
ref: ${{ github.event.pull_request.head.sha }}
3838
- name: Install Dependencies
3939
run: |
4040
npm install shelljs@0.8.5
@@ -102,4 +102,5 @@ jobs:
102102
uses: ./.github/workflows/reusable-workflow.yaml
103103
with:
104104
lib: ${{ matrix.lib }}
105+
is_pr: true
105106
secrets: inherit

.github/workflows/reusable-workflow.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
default: macos-15
1717
required: false
1818
type: string
19+
is_pr:
20+
type: boolean
21+
default: false
1922

2023
jobs:
2124
test-ios:
@@ -24,10 +27,14 @@ jobs:
2427
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile
2528
steps:
2629
- uses: actions/checkout@v4
27-
# We need a sufficient depth or Danger will occasionally run into issues
28-
# checking which files were modified.
30+
if: ${{ inputs.is_pr }}
2931
with:
32+
# We need a sufficient depth or Danger will occasionally run into issues checking which files were modified.
3033
fetch-depth: 100
34+
ref: ${{ github.event.pull_request.head.sha }}
35+
- uses: actions/checkout@v4
36+
if: ${{ ! inputs.is_pr }}
37+
with:
3138
ref: ${{ github.head_ref }}
3239
- name: Install Dependencies
3340
env:

0 commit comments

Comments
 (0)