diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b16030e..747ff49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,27 @@ jobs: runs-on: ubuntu-latest steps: - + - name: Check Team Membership + id: check_team + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_SECRET }} + TEAM_SLUG: 'reviewers' + ORG_NAME: 'paywallone' + run: | + ACTOR="${{ github.actor }}" + TEAM_MEMBERSHIP_RESPONSE=$(curl -s \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/orgs/$ORG_NAME/teams/$TEAM_SLUG/memberships/$ACTOR") + echo "$TEAM_MEMBERSHIP_RESPONSE" + if echo "$TEAM_MEMBERSHIP_RESPONSE" | grep -q '"state": "active"'; then + echo "Actor $ACTOR is a member of the team." + echo "::set-output name=is_member::true" + else + echo "Actor $ACTOR is NOT a member of the team." + echo "::set-output name=is_member::false" + exit 1 + fi - name: Checkout repository uses: actions/checkout@v4