-
-
Notifications
You must be signed in to change notification settings - Fork 60
47 lines (42 loc) · 1.6 KB
/
Copy pathauthorize_tsc_pc.yml
File metadata and controls
47 lines (42 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Authorize Technical Steering Committee and Project Committers
on:
workflow_call:
secrets:
WDIO_BOT_GITHUB_TOKEN:
required: true
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
jobs:
authorize:
runs-on: ubuntu-latest
steps:
# Step 1: Check Technical Steering Committee membership
- id: check_tsc
uses: octokit/request-action@v3.0.0
continue-on-error: true
with:
route: GET /orgs/:organisation/teams/:team/memberships/${{ github.actor }}
team: technical-steering-committee
organisation: webdriverio
env:
GITHUB_TOKEN: ${{ secrets.WDIO_BOT_GITHUB_TOKEN }}
# Step 2: Check Project Committers membership
- id: check_committers
uses: octokit/request-action@v3.0.0
continue-on-error: true
with:
route: GET /orgs/:organisation/teams/:team/memberships/${{ github.actor }}
team: project-committers
organisation: webdriverio
env:
GITHUB_TOKEN: ${{ secrets.WDIO_BOT_GITHUB_TOKEN }}
# Step 3: Evaluate if either check returned a 200 OK status
- name: Evaluate Authorization
run: |
TSC_STATUS="${{ steps.check_tsc.outputs.status }}"
COMMITTERS_STATUS="${{ steps.check_committers.outputs.status }}"
if [ "$TSC_STATUS" = "200" ] || [ "$COMMITTERS_STATUS" = "200" ]; then
echo "Access granted: User belongs to an authorized team."
else
echo "Access denied: User is not a member of TSC or Project Committers."
exit 1
fi