[ci] Automatically label PRs from core team (#32100)
Adds a new `MAINTAINERS` file which contains github usernames of core team members. This file serves as documentation for core team membership and is also used to automatically label PRs from core. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32100). * #32101 * __->__ #32100
lauren committed
Jan 16, 2025 at 14:16 UTC
af4987e19f0530cfd9f06b95680db7d02acacbd7
2 files changed
+64
.github/workflows/shared_core_label.yml
new
+41
@@ -0,0 +1,41 @@
1
+name: (Shared) Core Label
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
+ core_label:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - name: Check if actor is maintainer
17
+ id: check_maintainer
18
+ uses: actions/github-script@v7
19
+ with:
20
+ script: |
21
+ const fs = require('fs');
22
+ const actor = '${{ github.actor }}';
23
+ const data = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' });
24
+ const maintainers = new Set(data.split('\n'));
25
+ if (maintainers.has(actor)) {
26
+ console.log(`🟢 ${actor} is a maintainer`);
27
+ return true;
28
+ }
29
+ console.log(`🔴 ${actor} is NOT a maintainer`);
30
+ 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
+ });
MAINTAINERS
new
+23
@@ -0,0 +1,23 @@
1
+acdlite
2
+bvaughn
3
+eps1lon
4
+gaearon
5
+gnoff
6
+gsathya
7
+hoxyq
8
+jackpope
9
+jbonta
10
+josephsavona
11
+kassens
12
+lunaleaps
13
+mattcarrollcode
14
+mofeiZ
15
+noahlemen
16
+poteto
17
+rickhanlonii
18
+sebmarkbage
19
+sethwebster
20
+sophiebits
21
+TheSavior
22
+tyao1
23
+yuzhi