Skip to content

Commit ece62a6

Browse files
committed
Checkout correct branch on pull_request_target trigger
Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com>
1 parent 7682500 commit ece62a6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/smoke.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ name: "Run smoke tests via Tox::pytest"
44
# These tests will be long running and require accelerated hardware.
55

66
on:
7-
workflow_dispatch:
8-
inputs:
9-
branch:
10-
type: string
11-
default: main
7+
workflow_dispatch: {}
128
# using this rather than pull_request because this workflow
139
# needs to run in the context of the base branch (main) and
1410
# access the repo's secrets to start the AWS instances.
@@ -123,11 +119,16 @@ jobs:
123119
export PATH="${PATH}:${CUDA_HOME}/bin"
124120
nvidia-smi
125121
126-
- name: "Checkout code"
122+
- name: Checkout
127123
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
128124
with:
129125
fetch-depth: 0
130-
ref: ${{inputs.branch}}
126+
127+
- name: Fetch and checkout PR
128+
if: ${{ github.event_name == 'pull_request_target'}}
129+
run: |
130+
git fetch origin pull/${{ github.event.number }}/head:pr-${{ github.event.number }}
131+
git checkout pr-${{ github.event.number }}
131132
132133
# installs in $GITHUB_WORKSPACE/venv.
133134
# only has to install Tox because Tox will do the other virtual environment management.

0 commit comments

Comments
 (0)