Skip to content

Commit d7797ca

Browse files
committed
Add stewards list and updating action
1 parent 71b7e5e commit d7797ca

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

.github/workflows/stewards-update.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Update Steward Table in README
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- stewards.yml
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Setup Node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
20+
- name: Install dependencies
21+
run: npm install js-yaml
22+
23+
- name: Run table generator
24+
run: node utils/stewards-table.js
25+
26+
- name: Create Pull Request
27+
uses: peter-evans/create-pull-request@v5
28+
with:
29+
commit-message: "Update README table from stewards.yml"
30+
branch: update-readme-table
31+
title: 'chore: update README table from stewards.yml'
32+
body: 'This PR updates the README.md table to refelct changes in stewards.yml.'
33+
add: README.md

stewards.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
calebfoss:
3+
- Accessibility
4+
5+
davepagurek:
6+
- Core
7+
- Maintainers
8+
- Graphics:
9+
- WebGL
10+
11+
dhowe:
12+
- Typography
13+
14+
qianqianye:
15+
- Maintainers
16+
17+
ogbabydiesal:
18+
- p5.sound.js
19+
20+
limzykenneth:
21+
- Maintainers
22+
- DevOps
23+
- Documentation
24+
- Color
25+
- i18n:
26+
- zh
27+
28+
perminder-17:
29+
- Graphics:
30+
- WebGL
31+
- Documentation
32+
- Maintainers
33+
34+
lukeplowden:
35+
- Graphics:
36+
- WebGL
37+
- p5.strands
38+
39+
ksen0:
40+
- Maintainers
41+
- p5.js-website
42+
43+
Divyansh013:
44+
- i18n:
45+
- hi
46+
47+
GregStanton:
48+
- Math
49+
- Shapes
50+
51+
holomorfo:
52+
- Math
53+

utils/stewards-table.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const yaml = require('js-yaml');
2+
const fs = require('fs');
3+
4+
const yamlData = fs.readFileSync('stewards.yml', 'utf8');
5+
const parsed = yaml.load(yamlData);
6+
7+
const areaMap = {};
8+
const maintainers = new Set();
9+
const supportedi18n = new Set(['hi', 'ko', 'zh', 'es']);
10+
11+
for (const [user, roles] of Object.entries(parsed)) {
12+
roles.forEach(role => {
13+
if (typeof role === 'string') {
14+
if (role.toLowerCase() === 'maintainers') {
15+
maintainers.add(user);
16+
}
17+
areaMap[role] = areaMap[role] || new Set();
18+
areaMap[role].add(`@${user}`);
19+
} else {
20+
for (const [main, subs] of Object.entries(role)) {
21+
subs.forEach(sub => {
22+
if (main === 'i18n' && !supportedi18n.has(sub)) return;
23+
const key = `${main} (${sub})`;
24+
areaMap[key] = areaMap[key] || new Set();
25+
areaMap[key].add(`@${user}`);
26+
});
27+
}
28+
}
29+
});
30+
}
31+
32+
const header = '| Area | Steward(s) |';
33+
const divider = '|------|-------------|';
34+
35+
const sortedEntries = Object.entries(areaMap).sort(([aKey], [bKey]) => {
36+
if (aKey === 'Maintainers') return -1;
37+
if (bKey === 'Maintainers') return 1;
38+
return aKey.localeCompare(bKey);
39+
});
40+
41+
const rows = sortedEntries.map(([area, users]) => `| ${area} | ${[...users].sort().map(
42+
u => `[@${u}](https://github.com/${u})`
43+
).join(', ')} |`).join('\n');
44+
const newTable = [header, divider, rows].join('\n');
45+
46+
let readme = fs.readFileSync('README.md', 'utf8');
47+
48+
readme = readme.replace(
49+
/\| *Area *\|.*\n\|[-| ]+\|\n(?:\|.*\|\n?)*/g,
50+
newTable + '\n'
51+
);
52+
53+
fs.writeFileSync('README.md', readme);

0 commit comments

Comments
 (0)