Skip to content

Instantly share code, notes, and snippets.

@trashhalo
Last active January 17, 2022 22:06
Show Gist options
  • Save trashhalo/2e9e7ccf66bc513906461c4a8fbd79df to your computer and use it in GitHub Desktop.
Save trashhalo/2e9e7ccf66bc513906461c4a8fbd79df to your computer and use it in GitHub Desktop.
---
import { Octokit } from "octokit";
const octokit = new Octokit({ auth: import.meta.env.PUBLIC_GITHUB_TOKEN });
const allRepos = await octokit.rest.repos.listForAuthenticatedUser({
visibility: 'public',
per_page: 100
});
// topics are the tags you can assign like "astro". to avoid highlighting my junk projects I am only sharing
// projects that have the topic "pin"
const repos = allRepos.data.
filter(r => r.visibility == 'public' && !r.fork && r.topics.includes('pin')).
sort((a, b) => (a.stargazers_count < b.stargazers_count) ? 1 : -1);
---
{repos.map((repo) => (
<h4><a href={repo.html_url}>{repo.name}</a></h4>
<p>{repo.description}</p>
))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment