Skip to content

Commit 672b39c

Browse files
committed
[ci] Use shared maintainer check for discord notifications
Uses the shared maintainer check workflow across the various workflows that need it
1 parent b62eb2a commit 672b39c

File tree

4 files changed

+50
-21
lines changed

4 files changed

+50
-21
lines changed

.github/workflows/compiler_discord_notify.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
name: (Compiler) Discord Notify
22

33
on:
4-
pull_request_target:
5-
types: [labeled]
4+
pull_request:
65
paths:
76
- compiler/**
87
- .github/workflows/compiler_**.yml
98

109
jobs:
10+
check_maintainer:
11+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
12+
1113
notify:
12-
if: ${{ github.event.label.name == 'React Core Team' }}
14+
if: ${{ needs.check_maintainer.outputs.is_core_team }}
15+
needs: check_maintainer
1316
runs-on: ubuntu-latest
1417
steps:
1518
- name: Discord Webhook Action

.github/workflows/runtime_discord_notify.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
name: (Runtime) Discord Notify
22

33
on:
4-
pull_request_target:
5-
types: [labeled]
4+
pull_request:
65
paths-ignore:
76
- compiler/**
87
- .github/workflows/compiler_**.yml
98

109
jobs:
10+
check_maintainer:
11+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
12+
1113
notify:
12-
if: ${{ github.event.label.name == 'React Core Team' }}
14+
if: ${{ needs.check_maintainer.outputs.is_core_team }}
15+
needs: check_maintainer
1316
runs-on: ubuntu-latest
1417
steps:
1518
- name: Discord Webhook Action
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
name: (Shared) Core Label
1+
name: (Shared) Check maintainer
22

33
on:
4-
pull_request:
4+
workflow_call:
5+
outputs:
6+
is_core_team:
7+
value: ${{ jobs.check_maintainer.outputs.is_core_team }}
58

69
env:
710
TZ: /usr/share/zoneinfo/America/Los_Angeles
811
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
912
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
1013

1114
jobs:
12-
core_label:
15+
check_maintainer:
1316
runs-on: ubuntu-latest
17+
outputs:
18+
is_core_team: ${{ steps.check_if_actor_is_maintainer.outputs.result }}
1419
steps:
1520
- uses: actions/checkout@v4
1621
- name: Check if actor is maintainer
17-
id: check_maintainer
22+
id: check_if_actor_is_maintainer
1823
uses: actions/github-script@v7
1924
with:
2025
script: |
@@ -28,14 +33,3 @@ jobs:
2833
}
2934
console.log(`🔴 ${actor} is NOT a maintainer`);
3035
return null;
31-
- name: Label PR as React Core Team
32-
if: ${{ steps.check_maintainer.outputs.result }}
33-
uses: actions/github-script@v7
34-
with:
35-
script: |
36-
github.rest.issues.addLabels({
37-
owner: context.repo.owner,
38-
repo: context.repo.repo,
39-
issue_number: ${{ github.event.number }},
40-
labels: ['React Core Team']
41-
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: (Shared) Label Core Team PRs
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
TZ: /usr/share/zoneinfo/America/Los_Angeles
8+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
9+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
10+
11+
jobs:
12+
check_maintainer:
13+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
14+
15+
label:
16+
if: ${{ needs.check_maintainer.outputs.is_core_team }}
17+
runs-on: ubuntu-latest
18+
needs: check_maintainer
19+
steps:
20+
- name: Label PR as React Core Team
21+
uses: actions/github-script@v7
22+
with:
23+
script: |
24+
github.rest.issues.addLabels({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
issue_number: ${{ github.event.number }},
28+
labels: ['React Core Team']
29+
});

0 commit comments

Comments
 (0)