Skip to content

Commit efcae79

Browse files
committed
chore: update workflow to allow integration test runs against forked repo
1 parent 465901f commit efcae79

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

‎.github/workflows/integration_tests.yml‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,68 @@ name: Integration Tests
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'Branch or SHA to check out'
8+
required: false
9+
default: ''
10+
repository:
11+
description: 'Fork repository to check out'
12+
required: false
13+
default: ''
514
push:
615
branches:
716
- main
17+
paths-ignore:
18+
- '**/*.md'
19+
- '**/*.jpg'
20+
- '**/README.txt'
21+
- '**/LICENSE.txt'
22+
- 'docs/**'
23+
- 'ISSUE_TEMPLATE/**'
24+
- '**/remove-old-artifacts.yml'
25+
pull_request_target:
26+
branches:
27+
- main
28+
paths-ignore:
29+
- '**/*.md'
30+
- '**/*.jpg'
31+
- '**/README.txt'
32+
- '**/LICENSE.txt'
33+
- 'docs/**'
34+
- 'ISSUE_TEMPLATE/**'
35+
- '**/remove-old-artifacts.yml'
836

937
permissions:
1038
id-token: write # This is required for requesting the JWT
1139
contents: read # This is required for actions/checkout
1240

1341
jobs:
42+
approve:
43+
if: >
44+
github.event_name == 'push' ||
45+
github.event_name == 'workflow_dispatch' ||
46+
github.event.pull_request.head.repo.full_name == github.repository
47+
runs-on: ubuntu-latest
48+
steps:
49+
- run: echo "Approved — not a fork PR"
50+
51+
approve-fork:
52+
if: >
53+
github.event_name == 'pull_request_target' &&
54+
github.event.pull_request.head.repo.full_name != github.repository
55+
runs-on: ubuntu-latest
56+
environment: integration-tests
57+
steps:
58+
- run: echo "Fork PR approved by maintainer"
59+
1460
lts-integration-tests:
1561
name: Run LTS Integration Tests
62+
needs: [approve, approve-fork]
63+
if: |
64+
always() &&
65+
(needs.approve.result == 'success' || needs.approve-fork.result == 'success') &&
66+
!(needs.approve.result == 'failure' || needs.approve-fork.result == 'failure')
1667
runs-on: ubuntu-latest
1768
strategy:
1869
fail-fast: false
@@ -23,6 +74,9 @@ jobs:
2374
steps:
2475
- name: 'Clone repository'
2576
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
77+
with:
78+
repository: ${{ inputs.repository || github.event.pull_request.head.repo.full_name || github.repository }}
79+
ref: ${{ inputs.ref || github.event.pull_request.head.sha || github.sha }}
2680

2781
- name: 'Set up JDK 8'
2882
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
@@ -68,6 +122,9 @@ jobs:
68122
name: Run Latest Integration Tests
69123
runs-on: ubuntu-latest
70124
needs: lts-integration-tests
125+
if: |
126+
always() &&
127+
needs.lts-integration-tests.result == 'success'
71128
strategy:
72129
fail-fast: false
73130
matrix:
@@ -77,6 +134,9 @@ jobs:
77134
steps:
78135
- name: 'Clone repository'
79136
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
137+
with:
138+
repository: ${{ inputs.repository || github.event.pull_request.head.repo.full_name || github.repository }}
139+
ref: ${{ inputs.ref || github.event.pull_request.head.sha || github.sha }}
80140

81141
- name: 'Set up JDK 8'
82142
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5

0 commit comments

Comments
 (0)