[Rule Tunings] AWS S3 Bucket Replicated to Another Account | AWS S3 Bucket Policy Added to Share with External Account #3812
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Community | |
| on: | |
| pull_request_target: | |
| types: | |
| - opened | |
| issues: | |
| types: | |
| - opened | |
| jobs: | |
| label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if member of elastic org | |
| uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6 | |
| id: membership | |
| with: | |
| github-token: ${{ secrets.READ_ELASTIC_DETECTION_RULES_ORG_TOKEN }} | |
| result-encoding: string | |
| script: | | |
| try { | |
| const result = await github.rest.orgs.getMembershipForUser({ | |
| org: "elastic", | |
| username: '${{ github.actor }}' | |
| }) | |
| console.log(result?.data?.state) | |
| if (result?.data?.state == "active"){ | |
| console.log("%s: detected as an active member of elastic org", '${{ github.actor }}') | |
| return "member"; | |
| } else { | |
| console.log("%s: not detected as active member of elastic org", '${{ github.actor }}') | |
| return "notMember"; | |
| } | |
| } catch (error) { | |
| return "notMember"; | |
| } | |
| - name: Add label for community members | |
| uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6 | |
| if: ${{ steps.membership.outputs.result == 'notMember' }} | |
| with: | |
| script: | | |
| github.rest.issues.addLabels({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| labels: ['community'] | |
| }) |