|
42 | 42 | default: '30' |
43 | 43 |
|
44 | 44 | jobs: |
| 45 | + # Gate: Check if PR author is privileged (admin/maintain/write) |
| 46 | + # External contributors need maintainer approval via /ok-to-test (handled by gate workflow after merge) |
| 47 | + gate: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + outputs: |
| 50 | + should_run: ${{ steps.check.outputs.should_run }} |
| 51 | + steps: |
| 52 | + - name: Check permissions |
| 53 | + id: check |
| 54 | + uses: actions/github-script@v7 |
| 55 | + with: |
| 56 | + script: | |
| 57 | + // Always run for workflow_dispatch |
| 58 | + if (context.eventName === 'workflow_dispatch') { |
| 59 | + core.setOutput('should_run', 'true'); |
| 60 | + return; |
| 61 | + } |
| 62 | +
|
| 63 | + // Check PR author permission |
| 64 | + const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({ |
| 65 | + owner: context.repo.owner, |
| 66 | + repo: context.repo.repo, |
| 67 | + username: context.payload.pull_request.user.login |
| 68 | + }); |
| 69 | + const privilegedRoles = ['admin', 'maintain', 'write']; |
| 70 | + const isPrivileged = privilegedRoles.includes(permission.permission); |
| 71 | + console.log(`PR author ${context.payload.pull_request.user.login}: ${permission.permission}, privileged: ${isPrivileged}`); |
| 72 | + core.setOutput('should_run', isPrivileged ? 'true' : 'false'); |
| 73 | +
|
45 | 74 | # Build the WVA controller image on GitHub-hosted runner (has proper Docker setup) |
46 | 75 | build-image: |
| 76 | + needs: gate |
| 77 | + if: needs.gate.outputs.should_run == 'true' |
47 | 78 | runs-on: ubuntu-latest |
48 | 79 | outputs: |
49 | 80 | image_tag: ${{ steps.build.outputs.image_tag }} |
|
86 | 117 | # Run e2e tests on OpenShift self-hosted runner |
87 | 118 | e2e-openshift: |
88 | 119 | runs-on: [self-hosted, openshift] |
89 | | - needs: build-image |
| 120 | + needs: [gate, build-image] |
| 121 | + if: needs.gate.outputs.should_run == 'true' |
90 | 122 | env: |
91 | 123 | MODEL_ID: ${{ github.event.inputs.model_id || 'unsloth/Meta-Llama-3.1-8B' }} |
92 | 124 | ACCELERATOR_TYPE: ${{ github.event.inputs.accelerator_type || 'H100' }} |
|
0 commit comments