File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 66 actor :
77 required : true
88 type : string
9+ use_local :
10+ required : false
11+ type : boolean
12+ default : false
913 outputs :
1014 is_core_team :
1115 value : ${{ jobs.check_maintainer.outputs.is_core_team }}
2933 script : |
3034 const fs = require('fs');
3135 const actor = '${{ inputs.actor }}';
32- const data = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' });
33- const maintainers = new Set(data.split('\n'));
36+ const useLocal = ${{ inputs.use_local }};
37+
38+ let content = null;
39+ if (useLocal === true) {
40+ content = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' });
41+ } else {
42+ const res = await github.rest.repos.getContent({
43+ owner: 'facebook',
44+ repo: 'react',
45+ path: 'MAINTAINERS',
46+ ref: 'main',
47+ headers: { Accept: 'application/vnd.github+json' }
48+ });
49+ if (res.status !== 200) {
50+ console.error(res);
51+ throw new Error('Unable to fetch MAINTAINERS file');
52+ }
53+ content = Buffer.from(res.data.content, 'base64').toString();
54+ }
55+ if (content === null) {
56+ throw new Error('Unable to retrieve local or http MAINTAINERS file');
57+ }
58+
59+ const maintainers = new Set(content.split('\n'));
3460 if (maintainers.has(actor)) {
3561 console.log(`🟢 ${actor} is a maintainer`);
3662 return true;
Original file line number Diff line number Diff line change 11name : (Shared) Label Core Team PRs
22
33on :
4- pull_request_target :
4+ pull_request :
55
66env :
77 TZ : /usr/share/zoneinfo/America/Los_Angeles
1010
1111jobs :
1212 check_maintainer :
13- uses : facebook/react/.github/workflows/shared_check_maintainer.yml@main
13+ uses : facebook/react/.github/workflows/shared_check_maintainer.yml@pr32215
1414 with :
1515 actor : ${{ github.event.pull_request.user.login }}
1616
You can’t perform that action at this time.
0 commit comments