Skip to content

Commit ea8efbc

Browse files
authored
Ensure tests checkout PR branch (#1441)
* Ensure tests checkout PR branch If not explicit, on some PR or push events it might checkout main instead, which is not what we want on PR tests. * Fix it to PR head SHA * Reverse label/unlabel events * trigger on labeled always change * trigger on labeled/unlabeled only on regular PRs
1 parent 2c59d69 commit ea8efbc

File tree

10 files changed

+19
-4
lines changed

10 files changed

+19
-4
lines changed

.github/actions/build-push-image/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ runs:
7676
cache: false
7777
- name: Setup cache
7878
if: ${{ inputs.get-existing-cache == 'false' }}
79-
uses: actions/cache@v3
79+
uses: actions/cache@v4
8080
with:
8181
path: |
8282
~/.cache/go-build

.github/workflows/check-licenses.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{github.event.pull_request.head.sha}}
1214

1315
- name: Cache multiple paths
1416
uses: actions/cache@v4

.github/workflows/cloud-tests-filter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
run-cloud-tests: ${{ steps.tests-filter.outputs.run-cloud-tests }}
1919
steps:
2020
- uses: actions/checkout@v4
21+
with:
22+
ref: ${{github.event.pull_request.head.sha}}
2123
- uses: dorny/paths-filter@v3
2224
id: paths-filter
2325
with:

.github/workflows/lint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{github.event.pull_request.head.sha}}
1315

1416
- name: Setup Go
1517
uses: actions/setup-go@v5

.github/workflows/openshift-upgrade-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
name: Check out code
3737
uses: actions/checkout@v4
3838
with:
39+
ref: ${{github.event.pull_request.head.sha}}
3940
fetch-depth: 0 # required for tags
4041
- if: ${{ inputs.forked == true }}
4142
name: Check out code

.github/workflows/test-e2e.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
name: Check out code
2121
uses: actions/checkout@v4
2222
with:
23+
ref: ${{github.event.pull_request.head.sha}}
2324
submodules: true
2425
fetch-depth: 0
2526
- if: ${{ inputs.forked == true }}
@@ -55,6 +56,7 @@ jobs:
5556
name: Check out code
5657
uses: actions/checkout@v4
5758
with:
59+
ref: ${{github.event.pull_request.head.sha}}
5860
submodules: true
5961
fetch-depth: 0
6062
- if: ${{ inputs.forked == true }}
@@ -168,6 +170,7 @@ jobs:
168170
if: steps.get-repo-files-from-cache.outputs.cache-hit != 'true'
169171
uses: actions/checkout@v4
170172
with:
173+
ref: ${{github.event.pull_request.head.sha}}
171174
submodules: true
172175
fetch-depth: 0
173176
- name: Get all go dependencies

.github/workflows/test-int.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
- if: ${{ inputs.forked == false }}
2929
name: Check out code
3030
uses: actions/checkout@v4
31+
with:
32+
ref: ${{github.event.pull_request.head.sha}}
3133

3234
- if: ${{ inputs.forked == true }}
3335
name: Check out code

.github/workflows/test-unit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{github.event.pull_request.head.sha}}
1214

1315
- name: Cache multiple paths
1416
uses: actions/cache@v4

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ on:
77
paths-ignore:
88
- 'docs/**'
99
pull_request:
10-
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, unlabeled]
10+
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, labeled, unlabeled]
1111
branches:
1212
- '**'
1313
paths-ignore:
1414
- 'docs/**'
15-
pull_request_target: # for forked repos changes labeled 'safe-to-test' or 'cloud-tests'
16-
types: [labeled]
15+
pull_request_target:
1716
paths-ignore:
1817
- 'docs/**'
1918
merge_group:

.github/workflows/validate-manifests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{github.event.pull_request.head.sha}}
1214

1315
- name: Cache multiple paths
1416
uses: actions/cache@v4

0 commit comments

Comments
 (0)