File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change 66 actor :
77 required : true
88 type : string
9+ is_remote :
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 isRemote = ${{ inputs.is_remote }};
37+
38+ let content = null;
39+ if (isRemote === true) {
40+ const res = await github.rest.repos.getContent({
41+ owner: 'facebook',
42+ repo: 'react',
43+ path: 'MAINTAINERS',
44+ ref: 'main',
45+ headers: { Accept: 'application/vnd.github+json' }
46+ });
47+ if (res.status !== 200) {
48+ console.error(res);
49+ throw new Error('Unable to fetch MAINTAINERS file');
50+ }
51+ content = Buffer.from(res.data.content, 'base64').toString();
52+ } else {
53+ content = await fs.readFileSync('./MAINTAINERS', { encoding: 'utf8' });
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;
You can’t perform that action at this time.
0 commit comments