hackclub / contribute

A list of active Hack Club open source repositories with available issues on GitHub
http://contribute.hackclub.com
MIT License
13 stars 6 forks source link

Make repos list use GitHub API #12

Closed jessicard closed 2 years ago

jessicard commented 2 years ago

Make repos list use GitHub API.

Since it's a static site, we are using the unauthenticated API to grab open repos.

Fixes https://github.com/hackclub/contribute/issues/4 and https://github.com/hackclub/contribute/issues/6.

Screen Shot 2022-03-14 at 1 45 11 PM
vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hackclub/contribute/3YUHSudS6iTNpqLGVcwA9F1DuspM
✅ Preview: https://contribute-git-interactive-list.hackclub.dev

jessicard commented 2 years ago

@exu3 @sampoder Yes on all of these! I'll get an update pushed up :)

jessicard commented 2 years ago

@exu3 @sampoder Done! I know the issues & prs language is lengthy. We are running into an issue where, underneath, GitHub considers PRs and issues the same, so the API returns open_issues_count with the PRs included. There's no PR count returned with this endpoint, and we'll need to authenticate if we are going to do anything fancier I think. Not opposed to making it a full JS app to authenticate for the API, but want to get this out for now so we can use it tomorrow.

Screen Shot 2022-03-16 at 11 11 03 AM

jessicard commented 2 years ago

@exu3 @sampoder Going to merge this for now so I can get going on getting this out, but feedback is welcome!!

exu3 commented 2 years ago

I know the issues & prs language is lengthy. We are running into an issue where, underneath, GitHub considers PRs and issues the same, so the API returns open_issues_count with the PRs included.

Hmm maybe we could triage all the issues in active repos and tag them with "good-first-issue" as appropriate & have the badge show the number of issues with the "good-first-issue" label.

There's no PR count returned with this endpoint, and we'll need to authenticate if we are going to do anything fancier I think. Not opposed to making it a full JS app to authenticate for the API, but want to get this out for now so we can use it tomorrow.

I think it's important to keep this site static if it's going to serve as a demo use case of hackclub/css-theme. If necessary, maybe we could add an API route in hackclub/site to fetch data from GitHub and make a request to that endpoint instead of the GitHub API directly to get around rate limiting or if anything fancier is desired? Something like https://v3-1270gks8x.hackclub.dev/api/github/ (https://github.com/hackclub/site/commit/aa99f22181b5df7636b1eb2d1f1a3205d3fa14bc)

jessicard commented 2 years ago

@exu3 I totally agree about keeping it static if possible. If we need to make it an appy app, we could make a different demo, but for now I think keeping it static is ideal.

If we grabbed issues by their tag, since we're not using the GraphQL API (you need auth for it), it'll increase the queries from 1 query to N queries, since we'll have to query each repo. Right now we are querying 1 user (hack club). We are limited to 60 queries per hour while unauthenticated.

I love the idea of adding an API route in site! Then we aren't limited in what we want to do.

I also like the idea of tagging issues. I'm afraid this site will quickly become not useful if people aren't tagging issues though. So for now, maybe we just show all issues until we feel like everyone is tagging issues? I don't know, what do you think?

One note on good first issue - I was initially using this tag, but GitHub aggregates them for users to easily find open source issues to work on. Which is great in theory, but I'd love to keep these issues around for Hack Clubbers specifically to work on. I've started using beginner friendly as a tag instead. What do you think?

sampoder commented 2 years ago

We can also add API routes in this repo coz it's deployed on Vercel :D

jessicard commented 2 years ago

@sampoder Ooh how would that work here exactly?

@sampoder @exu3 If you're interested in taking this task on that would be amazing, since you both have experience with this in the rest of the site :)

One issue I do want to raise with the public API routes in general is that it opens us up to potentially get rate limited by GitHub if there's any abuse. But so far it looks like it's been working alright! :)

jessicard commented 2 years ago

@exu3 @sampoder Created an issue here: https://github.com/hackclub/contribute/issues/20