From e1389f67a1caa48d0158df5bc69f47297de17f13 Mon Sep 17 00:00:00 2001 From: faucomte97 Date: Fri, 15 Sep 2023 18:29:47 +0100 Subject: [PATCH] Test check team status --- .github/workflows/check_author.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/check_author.yml b/.github/workflows/check_author.yml index 6e03add0a..77ca42c09 100644 --- a/.github/workflows/check_author.yml +++ b/.github/workflows/check_author.yml @@ -4,19 +4,19 @@ on: pull_request: jobs: - check-author: - name: Check author - runs-on: ubuntu-20.04 + check-user: + name: Team affiliation + runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - name: Check user for team affiliation + uses: tspascoal/get-user-teams-membership@v2 + id: teamAffiliation with: - script: | - // If user is member of my_team team do nothing else do something - // See: https://octokit.github.io/rest.js/v18#teams - const creator = context.payload.sender.login - const result = await github.rest.teams.getMembershipForUserInOrg({ - org: context.repo.owner, - team_slug: 'codeforlife', - username: creator - }) - console.log(creator, result) // do whatever you want + GITHUB_TOKEN: ${{ secrets.TOKEN }} + username: ${{ github.actor }} + team: codeforlife + - name: Stop workflow if user is no member + if: ${{ steps.teamAffiliation.outputs.isTeamMember == false }} + run: | + echo "You have no rights to trigger this job." + exit 1