Skip to content

Commit 65721e5

Browse files
authored
fix: update version workflow (#214)
* fix: github token and check membership script
1 parent 8d3487e commit 65721e5

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
#!/bin/bash
22

3+
set -x
4+
35
USER=$1
4-
TOKEN=$2
56

6-
response=$(curl -s -H "Authorization: token $TOKEN" "https://api.github.com/orgs/immutable/teams/sdk/memberships/$USER")
7+
response=$(gh api \
8+
-H "Accept: application/vnd.github+json" \
9+
-H "X-GitHub-Api-Version: 2022-11-28" \
10+
"/orgs/immutable/teams/sdk/memberships/${USER}")
11+
12+
echo "$response"
713

8-
if echo "$response" | grep -q '"state": "active"'; then
9-
echo "true"
14+
if echo "$response" | grep -q '"state":"active"'; then
15+
IS_MEMBER=true
1016
else
11-
echo "false"
17+
IS_MEMBER=false
1218
fi
19+
echo "$IS_MEMBER"
20+
21+
# Set the environment variable for the GitHub workflow
22+
echo "IS_MEMBER=$IS_MEMBER" >> "$GITHUB_ENV"

.github/workflows/update-version.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,24 @@ on:
1111
jobs:
1212
update:
1313
runs-on: ubuntu-latest
14+
env:
15+
GH_TOKEN: ${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}
1416
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
1520
- name: Check team membership
1621
id: check_team
1722
run: |
18-
IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}")
23+
./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}"
24+
# shellcheck disable=SC1090
25+
source "$GITHUB_ENV"
26+
echo "${{ github.actor }} is a member of the SDK team: $IS_MEMBER"
1927
if [[ "$IS_MEMBER" != "true" ]]; then
2028
echo "Not a member of the SDK team, skipping update"
2129
exit 1
2230
fi
2331
24-
- name: Checkout code
25-
uses: actions/checkout@v3
26-
2732
- name: Set up Python
2833
uses: actions/setup-python@v4
2934
with:
@@ -54,4 +59,4 @@ jobs:
5459
body: "Update version in package.json"
5560
branch: "release/update-version"
5661
commit-message: "release: update version"
57-
labels: release
62+
labels: release

0 commit comments

Comments
 (0)