Skip to content

Commit 09f2baa

Browse files
committed
feat: check workflow actor is in the sdk team
1 parent 90e81d5 commit 09f2baa

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
USER=$1
4+
TOKEN=$2
5+
6+
response=$(curl -s -H "Authorization: token $TOKEN" "https://api.github.com/orgs/immutable/teams/sdk/memberships/$USER")
7+
8+
if echo "$response" | grep -q '"state": "active"'; then
9+
echo "true"
10+
else
11+
echo "false"
12+
fi

.github/workflows/update-version.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ on:
1010

1111
jobs:
1212
update:
13-
if: contains('["nattb8"]', github.actor)
1413
runs-on: ubuntu-latest
15-
1614
steps:
15+
- name: Check team membership
16+
id: check_team
17+
run: |
18+
IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}")
19+
if [[ "$IS_MEMBER" != "true" ]]; then
20+
echo "Not a member of the SDK team, skipping update"
21+
exit 1
22+
fi
23+
1724
- name: Checkout code
1825
uses: actions/checkout@v3
1926

0 commit comments

Comments
 (0)