mirror of
https://github.com/TRaSH-Guides/Guides.git
synced 2026-02-05 00:09:14 -06:00
more testing
This commit is contained in:
25
.github/scripts/update-contributors.js
vendored
25
.github/scripts/update-contributors.js
vendored
@@ -12,14 +12,31 @@
|
||||
throw new Error('Invalid response from GitHub API');
|
||||
}
|
||||
|
||||
const contributors = response.data.map(user => {
|
||||
let contributors = '<table>\n<tr>\n';
|
||||
|
||||
response.data.forEach((user, index) => {
|
||||
if (!user.login || !user.html_url || !user.avatar_url) {
|
||||
throw new Error('Invalid user data from GitHub API');
|
||||
}
|
||||
return `|  | [@${user.login}](${user.html_url}) |`;
|
||||
}).join('\n');
|
||||
|
||||
fs.writeFileSync('CONTRIBUTORS.md', `# Contributors\n\n| Avatar | Username |\n| --- | --- |\n${contributors}\n`);
|
||||
contributors += `
|
||||
<td align="center">
|
||||
<a href="${user.html_url}">
|
||||
<img src="${user.avatar_url}&s=100" width="100;" alt="${user.login}"/>
|
||||
<br />
|
||||
<sub><b>${user.login}</b></sub>
|
||||
</a>
|
||||
</td>`;
|
||||
|
||||
// Add a new row every 6th user
|
||||
if ((index + 1) % 6 === 0) {
|
||||
contributors += '\n</tr>\n<tr>\n';
|
||||
}
|
||||
});
|
||||
|
||||
contributors += '</tr>\n</table>';
|
||||
|
||||
fs.writeFileSync('CONTRIBUTORS.md', `## Contributors\n\n<!-- readme: contributors -start -->\n${contributors}\n<!-- readme: contributors -end -->\n`);
|
||||
} catch (error) {
|
||||
console.error('Error updating contributors:', error.message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user