-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratch.js
More file actions
29 lines (25 loc) · 819 Bytes
/
Copy pathscratch.js
File metadata and controls
29 lines (25 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('src/data/gsoc-orgs.json', 'utf8'));
let count = 0;
let githubCount = 0;
data.forEach(org => {
if (!org.githubRepo && org.ideas && org.ideas.includes('github.com')) {
try {
const url = new URL(org.ideas);
const parts = url.pathname.split('/').filter(Boolean);
if (parts.length >= 2) {
org.githubRepo = `${parts[0]}/${parts[1]}`;
githubCount++;
} else if (parts.length === 1) {
org.githubRepo = `${parts[0]}`; // just owner
githubCount++;
}
} catch (e) {
// invalid URL
}
}
if (org.githubRepo) count++;
});
console.log(`Total orgs: ${data.length}`);
console.log(`Newly populated githubRepos: ${githubCount}`);
console.log(`Total populated githubRepos: ${count}`);