Skip to content

fix: update version workflow #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/scripts/check_team_membership.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
#!/bin/bash

set -x

USER=$1
TOKEN=$2

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

echo "$response"

if echo "$response" | grep -q '"state": "active"'; then
echo "true"
if echo "$response" | grep -q '"state":"active"'; then
IS_MEMBER=true
else
echo "false"
IS_MEMBER=false
fi
echo "$IS_MEMBER"

# Set the environment variable for the GitHub workflow
echo "IS_MEMBER=$IS_MEMBER" >> "$GITHUB_ENV"
15 changes: 10 additions & 5 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@ on:
jobs:
update:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Check team membership
id: check_team
run: |
IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}")
./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}"
# shellcheck disable=SC1090
source "$GITHUB_ENV"
echo "${{ github.actor }} is a member of the SDK team: $IS_MEMBER"
if [[ "$IS_MEMBER" != "true" ]]; then
echo "Not a member of the SDK team, skipping update"
exit 1
fi

- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -54,4 +59,4 @@ jobs:
body: "Update version in package.json"
branch: "release/update-version"
commit-message: "release: update version"
labels: release
labels: release
Loading