| 1 | name: (Compiler) Discord Notify |
| 2 | |
| 3 | on: |
| 4 | pull_request_target: |
| 5 | types: [opened, ready_for_review] |
| 6 | paths: |
| 7 | - compiler/** |
| 8 | - .github/workflows/compiler_**.yml |
| 9 | |
| 10 | permissions: {} |
| 11 | |
| 12 | jobs: |
| 13 | check_access: |
| 14 | if: ${{ github.event.pull_request.draft == false }} |
| 15 | runs-on: ubuntu-latest |
| 16 | outputs: |
| 17 | is_member_or_collaborator: ${{ steps.check_is_member_or_collaborator.outputs.is_member_or_collaborator }} |
| 18 | steps: |
| 19 | - run: echo ${{ github.event.pull_request.author_association }} |
| 20 | - name: Check is member or collaborator |
| 21 | id: check_is_member_or_collaborator |
| 22 | if: ${{ github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR' }} |
| 23 | run: echo "is_member_or_collaborator=true" >> "$GITHUB_OUTPUT" |
| 24 | |
| 25 | check_maintainer: |
| 26 | if: ${{ needs.check_access.outputs.is_member_or_collaborator == 'true' || needs.check_access.outputs.is_member_or_collaborator == true }} |
| 27 | needs: [check_access] |
| 28 | uses: react/react/.github/workflows/shared_check_maintainer.yml@main |
| 29 | permissions: |
| 30 | # Used by check_maintainer |
| 31 | contents: read |
| 32 | with: |
| 33 | actor: ${{ github.event.pull_request.user.login }} |
| 34 | |
| 35 | notify: |
| 36 | if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }} |
| 37 | needs: check_maintainer |
| 38 | runs-on: ubuntu-latest |
| 39 | steps: |
| 40 | - name: Discord Webhook Action |
| 41 | uses: tsickert/discord-webhook@86dc739f3f165f16dadc5666051c367efa1692f4 |
| 42 | with: |
| 43 | webhook-url: ${{ secrets.COMPILER_DISCORD_WEBHOOK_URL }} |
| 44 | embed-author-name: ${{ github.event.pull_request.user.login }} |
| 45 | embed-author-url: ${{ github.event.pull_request.user.html_url }} |
| 46 | embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }} |
| 47 | embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}' |
| 48 | embed-description: ${{ github.event.pull_request.body }} |
| 49 | embed-url: ${{ github.event.pull_request.html_url }} |