Skip to content

Harden external-PR workflows and restrict command triggers #2

Harden external-PR workflows and restrict command triggers

Harden external-PR workflows and restrict command triggers #2

name: Trigger end-to-end tests on external PR approval
on:
pull_request_review:
types: [submitted]
jobs:
test:
name: Trigger end-to-end tests
# If reviewed by a repo(/org) owner
if: |
github.event.pull_request.author_association != 'MEMBER'
&& (
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)
|| contains(fromJson('["kieferro", "ewjoachim"]'), github.event.review.user.login)
)
&& github.event.review.state == 'approved'
&& contains(github.event.review.body, '/e2e')
runs-on: ubuntu-latest
steps:
- name: Store PR number in a file
run: echo "PR_NUMBER=${PR_NUMBER}" > pr_number.txt
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Save artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pr_number
path: pr_number.txt