diff --git a/.github/workflows/label-community-issues.yml b/.github/workflows/label-community-issues.yml index 0312d63efb..5b8c08d57c 100644 --- a/.github/workflows/label-community-issues.yml +++ b/.github/workflows/label-community-issues.yml @@ -12,42 +12,8 @@ jobs: contents: read steps: - # Adding this step for debug purposes - # If this works as expected, we can simplify this workflow - # and replace it with the `check-membership` step - - name: Check organization membership (test) - run: echo "${{ github.event.issue.author_association == 'MEMBER' }}" - - name: Check organization membership - id: check-membership - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.ORG_MEMBER_READ_TOKEN }} - result-encoding: string - script: | - const issueAuthor = '${{ github.event.issue.user.login }}'; - const orgName = 'elastic'; - - try { - await github.rest.orgs.getMembershipForUser({ - org: orgName, - username: issueAuthor - }); - - console.log(`${issueAuthor} is a member of ${orgName} organization`); - return 'member'; - - } catch (error) { - if (error.status === 404) { - console.log(`${issueAuthor} is not a member of ${orgName} organization`); - return 'non-member'; - } else { - console.log('Error checking organization membership:', error); - return 'error'; - } - } - - name: Add community label - if: steps.check-membership.outputs.result == 'non-member' + if: ${{ github.event.issue.author_association != 'MEMBER' }} uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }}