Skip to content

Commit dcf3843

Browse files
committed
[ci] Automatically label PRs from core team
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.
1 parent e5fdd99 commit dcf3843

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: (Shared) Core Label
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+
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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)