File tree Expand file tree Collapse file tree 4 files changed +74
-4
lines changed
Expand file tree Collapse file tree 4 files changed +74
-4
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,17 @@ name: (Compiler) Discord Notify
22
33on :
44 pull_request_target :
5- types : [labeled]
65 paths :
76 - compiler/**
87 - .github/workflows/compiler_**.yml
98
109jobs :
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
Original file line number Diff line number Diff line change @@ -2,14 +2,17 @@ name: (Runtime) Discord Notify
22
33on :
44 pull_request_target :
5- types : [labeled]
65 paths-ignore :
76 - compiler/**
87 - .github/workflows/compiler_**.yml
98
109jobs :
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
Original file line number Diff line number Diff line change 1+ name : (Shared) Check maintainer
2+
3+ on :
4+ workflow_call :
5+ outputs :
6+ is_core_team :
7+ value : ${{ jobs.check_maintainer.outputs.is_core_team }}
8+
9+ env :
10+ TZ : /usr/share/zoneinfo/America/Los_Angeles
11+ # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
12+ SEGMENT_DOWNLOAD_TIMEOUT_MINS : 1
13+
14+ jobs :
15+ check_maintainer :
16+ runs-on : ubuntu-latest
17+ outputs :
18+ is_core_team : ${{ steps.check_if_actor_is_maintainer.outputs.result }}
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Check if actor is maintainer
22+ id : check_if_actor_is_maintainer
23+ uses : actions/github-script@v7
24+ with :
25+ script : |
26+ const fs = require('fs');
27+ const actor = '${{ github.actor }}';
28+ const data = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' });
29+ const maintainers = new Set(data.split('\n'));
30+ if (maintainers.has(actor)) {
31+ console.log(`🟢 ${actor} is a maintainer`);
32+ return true;
33+ }
34+ console.log(`🔴 ${actor} is NOT a maintainer`);
35+ return null;
Original file line number Diff line number Diff line change 1+ name : (Shared) Label Core Team PRs
2+
3+ on :
4+ pull_request_target :
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+ });
You can’t perform that action at this time.
0 commit comments