Skip to content

test: improve E2E CI #3

test: improve E2E CI

test: improve E2E CI #3

Workflow file for this run

name: E2E Tests
on:
pull_request:
branches:
- '**'
push:
branches:
- '**'
jobs:
get-team-members:
runs-on: ubuntu-latest
outputs:
team-members: ${{ steps.get-team-members.outputs.team-members }}
steps:
- name: Get team members from GitHub API
id: get-team-members
run: |
TEAM_MEMBERS=$(gh api /orgs/pnpm/teams/collaborators/members --paginate | jq -r '.[].login' | paste -sd, -)
echo "team-members=$TEAM_MEMBERS" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-author:
runs-on: ubuntu-latest
needs: get-team-members
outputs:
is-external: ${{ steps.check-author.outputs.is-external }}
steps:
- name: Check if PR is from a team member
id: check-author
run: |
TEAM_MEMBERS="${{ needs.get-team-members.outputs.team-members }}"
if [ "${{ github.event.pull_request }}" != "" ]; then
if echo "$TEAM_MEMBERS" | grep -q "${{ github.actor }}"; then
echo "PR is from a team member."
echo "is-external=false" >> $GITHUB_OUTPUT
else
echo "PR is from an external contributor."
echo "is-external=true" >> $GITHUB_OUTPUT
fi
else
echo "Not a PR, running the workflow."
echo "is-external=false" >> $GITHUB_OUTPUT
fi
require-approval:
runs-on: ubuntu-latest
needs: check-author
if: needs.check-author.outputs.is-external == 'true'
steps:
- name: Manual Approval
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;
const repo = context.repo;
github.rest.pulls.requestReviewers({
owner: repo.owner,
repo: repo.repo,
pull_number: prNumber,
reviewers: ['nachoaldamav']
});
github-token: ${{ secrets.GITHUB_TOKEN }}
windows-tests:
needs: [require-approval, get-team-members]
uses: ./.github/workflows/windows.yml
macos-tests:
needs: [require-approval, get-team-members]
uses: ./.github/workflows/macos.yml
linux-tests:
needs: [require-approval, get-team-members]
uses: ./.github/workflows/linux.yml