From 4269c10a8fb7f639b3c989ab5e8ea4a5ad4630be Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 16 Jan 2025 11:36:09 -0500 Subject: [PATCH] [ci] Better filtering for discord notifications We don't always consistently use "tags" in commit messages, so let's use the filepaths modified in the PR instead to determine which channel to send notifications to. --- .github/workflows/compiler_discord_notify.yml | 24 +++++++++++++ .github/workflows/runtime_discord_notify.yml | 24 +++++++++++++ .github/workflows/shared_discord_notify.yml | 35 ------------------- 3 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/compiler_discord_notify.yml create mode 100644 .github/workflows/runtime_discord_notify.yml delete mode 100644 .github/workflows/shared_discord_notify.yml diff --git a/.github/workflows/compiler_discord_notify.yml b/.github/workflows/compiler_discord_notify.yml new file mode 100644 index 0000000000..3eeb009a78 --- /dev/null +++ b/.github/workflows/compiler_discord_notify.yml @@ -0,0 +1,24 @@ +name: (Compiler) Discord Notify + +on: + pull_request_target: + types: [labeled] + paths: + - compiler/** + - .github/workflows/compiler_**.yml + +jobs: + notify: + if: ${{ github.event.label.name == 'React Core Team' }} + runs-on: ubuntu-latest + steps: + - name: Discord Webhook Action + uses: tsickert/discord-webhook@v6.0.0 + with: + webhook-url: ${{ secrets.COMPILER_DISCORD_WEBHOOK_URL }} + embed-author-name: ${{ github.event.pull_request.user.login }} + embed-author-url: ${{ github.event.pull_request.user.html_url }} + embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }} + embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}' + embed-description: ${{ github.event.pull_request.body }} + embed-url: ${{ github.event.pull_request.html_url }} diff --git a/.github/workflows/runtime_discord_notify.yml b/.github/workflows/runtime_discord_notify.yml new file mode 100644 index 0000000000..5648a3a4ea --- /dev/null +++ b/.github/workflows/runtime_discord_notify.yml @@ -0,0 +1,24 @@ +name: (Shared) Discord Notify + +on: + pull_request_target: + types: [labeled] + paths-ignore: + - compiler/** + - .github/workflows/compiler_**.yml + +jobs: + notify_core: + if: ${{ github.event.label.name == 'React Core Team' }} + runs-on: ubuntu-latest + steps: + - name: Discord Webhook Action + uses: tsickert/discord-webhook@v6.0.0 + with: + webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} + embed-author-name: ${{ github.event.pull_request.user.login }} + embed-author-url: ${{ github.event.pull_request.user.html_url }} + embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }} + embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}' + embed-description: ${{ github.event.pull_request.body }} + embed-url: ${{ github.event.pull_request.html_url }} diff --git a/.github/workflows/shared_discord_notify.yml b/.github/workflows/shared_discord_notify.yml deleted file mode 100644 index da80c32ee2..0000000000 --- a/.github/workflows/shared_discord_notify.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: (Shared) Discord Notify - -on: - pull_request_target: - types: [labeled] - -jobs: - notify_core: - if: ${{ !contains(github.event.pull_request.title, '[compiler]') && github.event.label.name == 'React Core Team' }} - runs-on: ubuntu-latest - steps: - - name: Discord Webhook Action - uses: tsickert/discord-webhook@v6.0.0 - with: - webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} - embed-author-name: ${{ github.event.pull_request.user.login }} - embed-author-url: ${{ github.event.pull_request.user.html_url }} - embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }} - embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}' - embed-description: ${{ github.event.pull_request.body }} - embed-url: ${{ github.event.pull_request.html_url }} - notify_compiler: - if: ${{ contains(github.event.pull_request.title, '[compiler]') && github.event.label.name == 'React Core Team' }} - runs-on: ubuntu-latest - steps: - - name: Discord Webhook Action - uses: tsickert/discord-webhook@v6.0.0 - with: - webhook-url: ${{ secrets.COMPILER_DISCORD_WEBHOOK_URL }} - embed-author-name: ${{ github.event.pull_request.user.login }} - embed-author-url: ${{ github.event.pull_request.user.html_url }} - embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }} - embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}' - embed-description: ${{ github.event.pull_request.body }} - embed-url: ${{ github.event.pull_request.html_url }}