test new script changes

pull/1680/head
FonduemangVI 9 months ago
parent 533cdc1b7e
commit 16359db874

@ -3,10 +3,10 @@ const fs = require('fs');
// Indentation function // Indentation function
function indentString(string, indentation) { function indentString(string, indentation) {
return string.split('\n').map(line => indentation + line).join('\n'); return string.split('\n').map(line => indentation + line).join('\n').trim();
} }
let contributors = '<div style="display: flex; flex-wrap: wrap;">\n'; let contributors = '<div style="display: flex; flex-wrap: wrap;">';
let index = 0; let index = 0;
let page = 1; let page = 1;
@ -15,29 +15,25 @@ function fetchPage() {
.then((response) => { .then((response) => {
if (response.data.length === 0) { if (response.data.length === 0) {
// No more contributors, write the file // No more contributors, write the file
contributors += '</div>\n'; contributors += '\n</div>';
contributors = indentString(contributors, ''); contributors = indentString(contributors, '');
fs.writeFileSync('CONTRIBUTORS.md', `## Contributors\n\n<!-- readme: contributors -start -->\n${contributors}\n<!-- readme: contributors -end -->\n`); fs.writeFileSync('CONTRIBUTORS.md', `## Contributors\n\n<!-- readme: contributors -start -->\n${contributors}\n<!-- readme: contributors -end -->`);
return; return;
} }
response.data.forEach((user, i) => { response.data.forEach((user) => {
// Exclude bots and actions-user // Exclude bots and actions-user
if (user.type === 'Bot' || user.login.toLowerCase().includes('bot') || user.login === 'actions-user' || user.login === 'mynameisbogdan') return; if (user.type === 'Bot' || user.login.toLowerCase().includes('bot') || user.login === 'actions-user' || user.login === 'mynameisbogdan') return;
// Determine row index for background color
const rowIndex = Math.floor(index / 5);
const bgColor = (rowIndex % 2 === 0) ? '#1e2129' : '#303850';
const userHtml = ` const userHtml = `
<div style="flex: 1 1 20%; background-color: ${bgColor}; border: 1px solid #373a42; padding: 10px; text-align: center;"> <div style="flex: 1 1 20%; border: 1px solid black; box-sizing: border-box; padding: 10px; text-align: center;">
<img src="${user.avatar_url}&v=4" style="width: 50px; border-radius: 50%;" alt="${user.login}"/> <img src="${user.avatar_url}&v=4" style="width: 50px; border-radius: 50%;" alt="${user.login}">
<br /> <br>
<b><a href="${user.html_url}" style="color: #ffa500;">${user.login}</a></b> <b><a href="${user.html_url}">${user.login}</a></b>
</div>`; </div>`;
contributors += indentString(userHtml, ' '); contributors += '\n' + indentString(userHtml, ' ');
index++; index++;
}); });

Loading…
Cancel
Save