@samitouri / QOS-React / commits / e5fdd994bf

[ci] Better filtering for discord notifications (#32092)

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.

lauren committed Jan 16, 2025 at 12:09 UTC e5fdd994bf5262a6fbed5d08e93999bf0a7d234e
3 files changed +48 -35
.github/workflows/compiler_discord_notify.yml new
+24
@@ -0,0 +1,24 @@
1 +name: (Compiler) Discord Notify
2 +
3 +on:
4 + pull_request_target:
5 + types: [labeled]
6 + paths:
7 + - compiler/**
8 + - .github/workflows/compiler_**.yml
9 +
10 +jobs:
11 + notify:
12 + if: ${{ github.event.label.name == 'React Core Team' }}
13 + runs-on: ubuntu-latest
14 + steps:
15 + - name: Discord Webhook Action
16 + uses: tsickert/discord-webhook@v6.0.0
17 + with:
18 + webhook-url: ${{ secrets.COMPILER_DISCORD_WEBHOOK_URL }}
19 + embed-author-name: ${{ github.event.pull_request.user.login }}
20 + embed-author-url: ${{ github.event.pull_request.user.html_url }}
21 + embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }}
22 + embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}'
23 + embed-description: ${{ github.event.pull_request.body }}
24 + embed-url: ${{ github.event.pull_request.html_url }}
.github/workflows/runtime_discord_notify.yml new
+24
@@ -0,0 +1,24 @@
1 +name: (Runtime) Discord Notify
2 +
3 +on:
4 + pull_request_target:
5 + types: [labeled]
6 + paths-ignore:
7 + - compiler/**
8 + - .github/workflows/compiler_**.yml
9 +
10 +jobs:
11 + notify:
12 + if: ${{ github.event.label.name == 'React Core Team' }}
13 + runs-on: ubuntu-latest
14 + steps:
15 + - name: Discord Webhook Action
16 + uses: tsickert/discord-webhook@v6.0.0
17 + with:
18 + webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
19 + embed-author-name: ${{ github.event.pull_request.user.login }}
20 + embed-author-url: ${{ github.event.pull_request.user.html_url }}
21 + embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }}
22 + embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}'
23 + embed-description: ${{ github.event.pull_request.body }}
24 + embed-url: ${{ github.event.pull_request.html_url }}
.github/workflows/shared_discord_notify.yml deleted
-35
@@ -1,35 +0,0 @@
1 -name: (Shared) Discord Notify
2 -
3 -on:
4 - pull_request_target:
5 - types: [labeled]
6 -
7 -jobs:
8 - notify_core:
9 - if: ${{ !contains(github.event.pull_request.title, '[compiler]') && github.event.label.name == 'React Core Team' }}
10 - runs-on: ubuntu-latest
11 - steps:
12 - - name: Discord Webhook Action
13 - uses: tsickert/discord-webhook@v6.0.0
14 - with:
15 - webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
16 - embed-author-name: ${{ github.event.pull_request.user.login }}
17 - embed-author-url: ${{ github.event.pull_request.user.html_url }}
18 - embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }}
19 - embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}'
20 - embed-description: ${{ github.event.pull_request.body }}
21 - embed-url: ${{ github.event.pull_request.html_url }}
22 - notify_compiler:
23 - if: ${{ contains(github.event.pull_request.title, '[compiler]') && github.event.label.name == 'React Core Team' }}
24 - runs-on: ubuntu-latest
25 - steps:
26 - - name: Discord Webhook Action
27 - uses: tsickert/discord-webhook@v6.0.0
28 - with:
29 - webhook-url: ${{ secrets.COMPILER_DISCORD_WEBHOOK_URL }}
30 - embed-author-name: ${{ github.event.pull_request.user.login }}
31 - embed-author-url: ${{ github.event.pull_request.user.html_url }}
32 - embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }}
33 - embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}'
34 - embed-description: ${{ github.event.pull_request.body }}
35 - embed-url: ${{ github.event.pull_request.html_url }}