From bab70aebb0e1bee4b0bd740574c620e56b5efe2d Mon Sep 17 00:00:00 2001 From: Rushi Vishavadia Date: Mon, 9 Sep 2024 14:35:51 +0530 Subject: [PATCH] Update eslint.yml --- .github/workflows/eslint.yml | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index c70bdd2e6..32012e0a5 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -16,7 +16,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -permissions: write-all +permissions: + checks: write + pull-requests: write jobs: Lint: @@ -24,25 +26,19 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check if user belongs to the organization - id: check-org - run: | - ORG_NAME="xola" - USER=$(jq -r .pull_request.user.login $GITHUB_EVENT_PATH) - USER_ORG=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/users/$USER/orgs | jq -r ".[].login") - if [[ "$USER_ORG" == "$ORG_NAME" ]]; then - echo "User is a member of $ORG_NAME" - echo ::set-output name=org-member::true - else - echo "User is not a member of $ORG_NAME" - echo ::set-output name=org-member::false - exit 1 - fi - - - name: Run workflow if user is in organization - if: steps.check-org.outputs.org-member == 'true' + - name: Check user for team affiliation + uses: tspascoal/get-user-teams-membership@v2 + id: teamAffiliation + with: + GITHUB_TOKEN: ${{ secrets.TEMP_ORG_READ_TOKEN }} + username: ${{ github.actor }} + organization: xola + + - name: Stop workflow if user is no member run: | - echo "User is in organization!" + echo "Debugging" + echo ${{steps.teamAffiliation.outputs.teams}} + exit 1 - uses: actions/checkout@v3 with: