Skip to content

Commit

Permalink
added ignoredUsers
Browse files Browse the repository at this point in the history
  • Loading branch information
jcabak committed Jul 1, 2024
1 parent 252f9c4 commit 2b5cf6a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions update-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const username = 'jcabak';
const accessToken = process.env.GH_TOKEN;
const shouldBold = true; // Set to true by default
const favoriteRepositories = ['rails', 'microsoft', 'apple', 'home-assistant', 'google', 'raspberry', 'twitter', 'mozilla', 'facebook', 'googlechrome', 'nasa', 'w3c', 'basecamp'];
const ignoredUsers = ['BinaryWorlds', 'wangchucheng'];

async function fetchPullRequests() {
try {
Expand All @@ -21,15 +22,23 @@ async function fetchPullRequests() {
for (const pullRequest of pullRequests) {
const repositoryOwnerAvatarUrl = await fetchRepositoryOwnerAvatar(pullRequest.repository_url);
const repositoryOwner = await fetchRepositoryOwner(pullRequest.repository_url);

// Ignore the repository if the owner is in the ignoredUsers list
if (ignoredUsers.includes(repositoryOwner)) {
continue;
}

const repositoryUrl = await fetchRepositoryUrl(pullRequest.repository_url);
const repositoryName = await fetchRepositoryName(pullRequest.repository_url);
const repositoryStars = await fetchRepositoryStars(pullRequest.repository_url);
const repositoryForks = await fetchRepositoryForks(pullRequest.repository_url);

const repositoryOwnerUrl = `https://github.com/${repositoryOwner}`;

if (shouldBold && favoriteRepositories.includes(repositoryOwner.toLowerCase())) {
markdownContent += `| <img src="${repositoryOwnerAvatarUrl}" alt="Logo ${repositoryOwner}" width="30" height="30"> | [**${repositoryOwner}**](${repositoryUrl}) | [**${repositoryName}**](${repositoryUrl}) | **${repositoryStars}** | **${repositoryForks}** | **${pullRequest.title}** |\n`;
markdownContent += `| <img src="${repositoryOwnerAvatarUrl}" alt="Logo ${repositoryOwner}" width="30" height="30"> | [**${repositoryOwner}**](${repositoryOwnerUrl}) | [**${repositoryName}**](${repositoryUrl}) | **${repositoryStars}** | **${repositoryForks}** | **${pullRequest.title}** |\n`;
} else {
markdownContent += `| <img src="${repositoryOwnerAvatarUrl}" alt="Logo ${repositoryOwner}" width="30" height="30"> | [${repositoryOwner}](${repositoryUrl}) | [${repositoryName}](${repositoryUrl}) | ${repositoryStars} | ${repositoryForks} | ${pullRequest.title} |\n`;
markdownContent += `| <img src="${repositoryOwnerAvatarUrl}" alt="Logo ${repositoryOwner}" width="30" height="30"> | [${repositoryOwner}](${repositoryOwnerUrl}) | [${repositoryName}](${repositoryUrl}) | ${repositoryStars} | ${repositoryForks} | ${pullRequest.title} |\n`;
}
}

Expand Down Expand Up @@ -131,4 +140,4 @@ async function fetchRepositoryForks(repoUrl) {
}
}

fetchPullRequests();
fetchPullRequests();

0 comments on commit 2b5cf6a

Please sign in to comment.