Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Akashic101 committed Apr 30, 2024
1 parent 34fe114 commit 049d7c9
Show file tree
Hide file tree
Showing 2 changed files with 214 additions and 0 deletions.
82 changes: 82 additions & 0 deletions github-repo-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
const { Octokit } = require('@octokit/rest');
const repositoryURLs = require('./repos');

// Initialize Octokit with your personal access token
const octokit = new Octokit({ auth: process.env.GITHUB_SECRET });

// Function to extract owner and repo name from repository URL
function extractOwnerAndRepo(url) {
const parts = url.split('/');
const owner = parts[parts.length - 2];
const repo = parts[parts.length - 1];
return { owner, repo };
}

// Function to count open issues and pull requests
async function countOpenIssuesAndPRs(repository) {
try {
const response = await octokit.issues.listForRepo({
owner: repository.owner,
repo: repository.repo,
state: 'open',
});

// Count open issues and pull requests
const openIssuesCount = response.data.filter((issue) => !issue.pull_request).length;
const openPRsCount = response.data.filter((issue) => issue.pull_request).length;

// Return total issues count and PRs count
return {
repository: `${repository.owner}/${repository.repo}`,
openIssues: openIssuesCount,
openPRs: openPRsCount,
};
} catch (error) {
console.error(
`Error counting open issues and pull requests for repository ${repository.owner}/${repository.repo}:`,
error.message,
);
// Return 0 for both counts if an error occurs
return {
repository: `${repository.owner}/${repository.repo}`,
openIssues: 0,
openPRs: 0,
};
}
}

// Sort repositories based on the number of issues and pull requests
async function sortRepositoriesByIssuesAndPRs() {
const repositoriesWithCounts = await Promise.all(
repositoryURLs.map((url) => {
const { owner, repo } = extractOwnerAndRepo(url);
return countOpenIssuesAndPRs({ owner, repo });
}),
);

// Sort repositories by number of issues and pull requests
repositoriesWithCounts.sort((a, b) => {
if (a.openIssues !== b.openIssues) {
return b.openIssues - a.openIssues; // Sort by number of issues descending
} else {
return b.openPRs - a.openPRs; // Sort by number of PRs descending if issues count is equal
}
});

return repositoriesWithCounts;
}

// Print sorted repositories
async function printSortedRepositories() {
const sortedRepositories = await sortRepositoriesByIssuesAndPRs();
sortedRepositories.forEach((repository) => {
console.log(
`Repository: ${repository.repository} (https://github.com/${repository.repository})`,
);
console.log(`Open Issues: ${repository.openIssues}`);
console.log(`Open Pull Requests: ${repository.openPRs}`);
console.log('---');
});
}

printSortedRepositories();
132 changes: 132 additions & 0 deletions repo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
const repositoryURLs = [
'https://github.com/scinos/eleventy-plugin-react-ssr',
'https://github.com/daviddarnes/eleventy-plugin-ghost',
'https://github.com/JKC-Codes/eleventy-plugin-time-to-read',
'https://github.com/JordanShurmer/eleventy-plugin-toc',
'https://github.com/bart-jaskulski/eleventy-postcss-extension',
'https://github.com/quasibit/eleventy-plugin-sitemap',
'https://github.com/Ryuno-Ki/eleventy-filter-npm-package-downloads',
'https://github.com/jdvivar/eleventy-plugin-add-web-component-definitions',
'https://github.com/tannerdolby/eleventy-plugin-metagen',
'https://github.com/kentaroi/eleventy-sass',
'https://github.com/reatlat/eleventy-plugin-atlasicons',
'https://github.com/johnwargo/eleventy-plugin-post-stats',
'https://github.com/mightyplow/eleventy-plugin-cache-buster',
'https://github.com/liamfiddler/eleventy-plugin-lazyimages',
'https://github.com/seanmcp/eleventy-plugin-heroicons',
'https://github.com/jeremenichelli/eleventy-xml-plugin',
'https://github.com/vseventer/eleventy-plugin-helmet',
'https://github.com/saneef/eleventy-plugin-img2picture',
'https://github.com/tannerdolby/eleventy-plugin-social-img',
'https://github.com/gregives/eleventy-critical-css',
'https://github.com/vidhill/fortawesome-brands-svg-11ty-shortcode',
'https://github.com/johnwargo/eleventy-plugin-github-repos',
'https://github.com/chrisburnell/eleventy-cache-webmentions',
'https://github.com/gingerchew/eleventy-plugin-target-safe',
'https://github.com/tpiros/eleventy-plugin-social-share-card-generator',
'https://github.com/sardinedev/eleventy-plugins',
'https://github.com/kijowski/eleventy-plugin-org',
'https://github.com/TigersWay/eleventy-plugin-ancestry',
'https://github.com/johnwargo/eleventy-plugin-file-list',
'https://github.com/johnwargo/eleventy-plugin-future-post',
'https://github.com/ogdenstudios/eleventy-plugin-markdown-shortcode',
'https://github.com/voorjaar/eleventy-plugin-mtos',
'https://github.com/sardinedev/eleventy-plugins',
'https://github.com/CodeFoodPixels/eleventy-plugin-webmentions',
'https://github.com/victornpb/eleventy-plugin-page-assets',
'https://github.com/pcdevil/eleventy-plugin-intl-utils',
'https://github.com/orchidjs/eleventy-plugin-ids',
'https://github.com/proog/eleventy-plugin-purgecss',
'https://github.com/johanbrook/eleventy-plugin-typeset',
'https://github.com/GrimLink/eleventy-plugin-lucide-icons',
'https://github.com/jaredgorski/eleventy-njk-unpkg-inliner',
'https://github.com/JKC-Codes/eleventy-plugin-automatic-noopener',
'https://github.com/Snapstromegon/eleventy-plugin-rollup',
'https://github.com/silexlabs/eleventy-plugin-directus',
'https://github.com/patrickxchong/eleventy-plugin-svg-sprite',
'https://github.com/j-f1/eleventy-hast-jsx',
'https://github.com/christopherpickering/eleventy-plugin-edit-on-github',
'https://github.com/takanorip/eleventy-google-fonts',
'https://github.com/sardinedev/eleventy-plugins',
'https://github.com/adamculpepper/eleventy-plugin-responsive-images',
'https://github.com/sophiekoonin/eleventy-plugin-redirects',
'https://github.com/kev4ev/eleventy-plugin-drawio',
'https://github.com/atomrc/eleventy-favicon',
'https://github.com/gregives/eleventy-load',
'https://github.com/KiwiKilian/eleventy-plugin-og-image',
'https://github.com/bnoctis/eleventy-multisite',
'https://github.com/CavaleriDK/eleventy-plugin-embed-itch-io',
'https://github.com/bmuenzenmeyer/eleventy-plugin-inline-link-favicon',
'https://github.com/reatlat/eleventy-plugin-vidyard',
'https://github.com/saneef/eleventy-plugin-asciidoc',
'https://github.com/adamduncan/eleventy-plugin-i18n',
'https://github.com/dleatherman/eleventy-plugin-shopify',
'https://github.com/sgissinger/eleventy-plugin-i18n-gettext',
'https://github.com/jdsteinbach/eleventy-plugin-toc',
'https://github.com/johanbrook/eleventy-plugin-reading-time',
'https://github.com/daviddarnes/eleventy-plugin-unfurl',
'https://github.com/dafiulh/eleventy-plugin-tailwindcss',
'https://github.com/SeanMcP/eleventy-plugin-emoji',
'https://github.com/AramZS/eleventy-plugin-dart-sass',
'https://github.com/eeeps/eleventy-respimg',
'https://github.com/florianeckerstorfer/eleventy-plugin-remark',
'https://github.com/shawn-sandy/idea',
'https://github.com/TheDocTrier/eleventy-plugin-ignore',
'https://github.com/tannerdolby/eleventy-plugin-sharp-respfigure',
'https://github.com/ashur/eleventy-plugin-classnames',
'https://github.com/okitavera/eleventy-plugin-pwa',
'https://github.com/KittyGiraudel/eleventy-plugin-footnotes',
'https://github.com/uncenter/eleventy-plugin-validate',
'https://github.com/uncenter/eleventy-plugin-icons',
'https://github.com/declanbyrd/eleventy-plugin-mastoarchive',
'https://github.com/codegouvfr/eleventy-plugin-calendar',
'https://github.com/tannerdolby/eleventy-plugin-sharp-respimg',
'https://github.com/bradleyburgess/eleventy-plugin-broken-links',
'https://github.com/kitschpatrol/tldraw-cli',
'https://github.com/reatlat/eleventy-plugin-hubspot',
'https://github.com/juanfernandes/eleventy-plugin-cloudinary',
'https://github.com/tsung-ju/eleventy-plugin-mathjax',
'https://github.com/lwojcik/eleventy-plugin-pwa-v2',
'https://github.com/thigoap/eleventy-plugin-reader-bar',
'https://github.com/binyamin/eleventy-plugin-backlinks',
'https://github.com/mathieuprog/eleventy-i18n',
'https://github.com/timkley/eleventy-plugin-torchlight',
'https://github.com/ashur/eleventy-plugin-find',
'https://github.com/NickColley/eleventy-plugin-unified',
'https://github.com/nhoizey/eleventy-plugin-link_to',
'https://github.com/GrimLink/eleventy-plugin-sass',
'https://github.com/awaragi/eleventy-plugin-plantuml',
'https://github.com/Nixinova/Wikity',
'https://github.com/quasibit/eleventy-plugin-schema',
'https://github.com/saneef/eleventy-plugin-git-commit-date',
'https://github.com/sardinedev/eleventy-plugins',
'https://github.com/AleksandrHovhannisyan/eleventy-plugin-code-demo',
'https://github.com/matt-auckland/eleventy-plugin-html-validate',
'https://github.com/gfscott/eleventy-plugin-embed-everything',
'https://github.com/idris-maps/code-blocks',
'https://github.com/fershad/eleventy-plugin-green-links',
'https://github.com/jeremenichelli/eleventy-nbsp-filter',
'https://github.com/nhoizey/eleventy-plugin-images-responsiver',
'https://github.com/cfjedimaster/eleventy-plugin-pdfembed',
'https://github.com/vidhill/fortawesome-regular-svg-11ty-shortcode',
'https://github.com/reatlat/eleventy-plugin-feathericons',
'https://github.com/5t3ph/eleventy-plugin-emoji-readtime',
'https://github.com/JKC-Codes/eleventy-plugin-code-style-hooks',
'https://github.com/factorial-io/eleventy-plugin-twig',
'https://github.com/gingerchew/eleventy-plugin-plausible',
'https://github.com/luwes/eleventy-plugin-sharp',
'https://github.com/genehack/eleventy-plugin-json-feed',
'https://github.com/adueppen/eleventy-img-helper',
'https://github.com/sardinedev/eleventy-plugins',
'https://github.com/ashur/eleventy-plugin-add-remote-data',
'https://github.com/inframanufaktur/eleventy-plugin-clean-urls',
'https://github.com/reatlat/eleventy-plugin-phosphoricons',
'https://github.com/Resocio/eleventy-plugin-social-image',
'https://github.com/solution-loisir/markdown-it-eleventy-img',
'https://github.com/workeffortwaste/eleventy-plugin-recent-changes',
'https://github.com/NJAldwin/eleventy-plugin-gen-favicons',
'https://github.com/factorial-io/eleventy-plugin-fstack',
'https://github.com/whoisvadym/eleventy-plugin-postcss',
];

module.exports = repositoryURLs;

0 comments on commit 049d7c9

Please sign in to comment.