Skip to content

Commit e001371

Browse files
authored
feat: Add external PR safe to test support (#145)
Use pull_request_target trigger condition to support external PR and use `ok-to-test` label to allow the CI running.
1 parent 9c344ee commit e001371

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/acctest.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@
1313
# limitations under the License.
1414

1515
name: Tests
16-
on: [pull_request]
16+
on:
17+
pull_request:
18+
pull_request_target:
19+
types: [labeled]
20+
1721
jobs:
1822
acctest:
1923
name: Run acceptance tests
24+
if: |
25+
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
26+
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'ok-to-test'))
2027
runs-on: ubuntu-latest
2128
env:
2229
ACC_TEST_SERVICE_ACCOUNT: ${{ secrets.ACC_TEST_SERVICE_ACCOUNT }}
@@ -27,6 +34,8 @@ jobs:
2734
steps:
2835
- name: Checkout Code
2936
uses: actions/checkout@v3
37+
with:
38+
ref: ${{ github.event.pull_request.head.sha }}
3039

3140
- name: Setup Go
3241
uses: actions/setup-go@v3

0 commit comments

Comments
 (0)