Skip to content

Commit ffb58a0

Browse files
committed
Checkout forked code when running CI against pull requests
1 parent 2aaf656 commit ffb58a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ jobs:
2323
BUNDLE_WITHOUT: lint
2424
steps:
2525
- name: Checkout code
26+
if: github.event_name == 'push'
2627
uses: actions/checkout@v4
2728

29+
- name: Checkout PR code
30+
if: github.event_name == 'pull_request_target'
31+
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.pull_request.head.ref }}
34+
repository: ${{ github.event.pull_request.head.repo.full_name }}
35+
2836
- name: Set up Ruby
2937
uses: ruby/setup-ruby@v1
3038
with:
@@ -41,8 +49,16 @@ jobs:
4149
runs-on: ubuntu-24.04
4250
steps:
4351
- name: Checkout code
52+
if: github.event_name == 'push'
4453
uses: actions/checkout@v4
4554

55+
- name: Checkout PR code
56+
if: github.event_name == 'pull_request_target'
57+
uses: actions/checkout@v4
58+
with:
59+
ref: ${{ github.event.pull_request.head.ref }}
60+
repository: ${{ github.event.pull_request.head.repo.full_name }}
61+
4662
- name: Set up Ruby
4763
uses: ruby/setup-ruby@v1
4864
with:

0 commit comments

Comments
 (0)