Skip to content

Commit 785c906

Browse files
committed
Allow for testing external PR securely
1 parent cc0a43e commit 785c906

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

.github/workflows/parallel_tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ name: Parallel Tests
55
on:
66
# Allow to repo owner to manually run this workflow for external PRs once code is vetted
77
workflow_dispatch:
8-
8+
pull_request_review:
9+
types: [submitted]
10+
911
# Run automatically for internal PRs and pushes
1012
pull_request:
1113
branches:
@@ -20,6 +22,7 @@ on:
2022
jobs:
2123

2224
test_installer: # test install_ubuntu.sh
25+
if: github.event.review.state == 'approved'
2326
runs-on: panda-arc # Note 22.04 would work, but it requires docker > 20.10.7 which is not on our CI box (yet)
2427
container:
2528
image: ubuntu:20.04
@@ -44,9 +47,8 @@ jobs:
4447
- name: Run install_ubuntu.sh
4548
run: cd $GITHUB_WORKSPACE && ./panda/scripts/install_ubuntu.sh
4649

47-
4850
build_container:
49-
if: github.repository == 'panda-re/panda'
51+
if: github.repository == 'panda-re/panda' && github.event.review.state == 'approved'
5052
runs-on: panda-arc
5153
steps:
5254
- name: Install git
@@ -73,7 +75,7 @@ jobs:
7375
run: docker run --rm "ghcr.io/${{ github.repository_owner }}/panda_local:${{ github.sha }}" /bin/bash -c 'exit $(/panda/build/arm-softmmu/panda-system-arm -help | grep -q "usage. panda-system-arm")'
7476

7577
tests:
76-
if: github.repository == 'panda-re/panda'
78+
if: github.repository == 'panda-re/panda' && github.event.review.state == 'approved'
7779
runs-on: panda-arc
7880
needs: [build_container]
7981

@@ -140,9 +142,9 @@ jobs:
140142
141143
cleanup:
142144
# Cleanup after prior jobs finish - even if they fail
145+
if: always()
143146
needs: [tests]
144147
runs-on: panda-arc
145-
if: always()
146148

147149
steps:
148150
# Note we leave the last 72hrs because caching is nice (first few panda image layers won't change often)
@@ -156,7 +158,7 @@ jobs:
156158
157159
build_and_check_fork: # Forked repos can't use panda-arc test suite - just checkout and run make check
158160
if: github.repository != 'panda-re/panda'
159-
runs-on: panda-arc
161+
runs-on: ubuntu-20.04
160162

161163
steps:
162164
- uses: actions/checkout@v4 # Clones code into to /home/runner/work/panda

.github/workflows/review-approval.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Review Approval
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
pull_request_review:
7+
types: [submitted]
8+
9+
jobs:
10+
approve-workflow:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check if review is approved
14+
if: github.event_name == 'pull_request_review' && github.event.review.state == 'approved'
15+
run: echo "Review approved"
16+
17+
- name: Require new approval for new pushes
18+
if: github.event_name == 'pull_request_target'
19+
run: echo "New push detected, approval required"

0 commit comments

Comments
 (0)