CodeTriage
CodeTriage copied to clipboard
Support targeting repos with specific label like #hacktoberfest
Maintainer of CodeTriage here. I'm interested in adding a proof of concept for displaying repos with a given tag. Let's keep it simple and start with #hacktoberfest on one new page as the goal. We can do this as an experiment.
Context
Every year Digital Ocean sends shirts to developers who get qualifying commits in open source during the month of October.
In prior years this caused spam as projects not equipped to get new PRs would get an influx of work. To help the new rule is projects must have ahacktoberfest or hacktoberfest-accepted label.
From: https://hacktoberfest.com/participation/
Hacktoberfest is now opt-in for maintainers, so only contribute to projects that indicate they’re looking for Hacktoberfest PR/MRs.
Once your PR/MR has passed this check, we won’t check this again (unless your PR/MR fails a check before this, such as it being marked as spammy).
Implementation
I'm thinking it could be fun for someone to write such a page for hacktoberfest. Basically wait until October 1st then send a PR. I'll be happy to hacktoberfest-accepted this feature.
It will need:
- Create a task to schedule importing the data: Recurring tasks are all in https://github.com/codetriage/CodeTriage/blob/05f248a9af1af718852fbcd14d746d878650324d/lib/tasks/schedule.rake. Adding a new task would probably be the easiest for now.
- Grab data about the github repo. For interactiong with github API I use https://github.com/zombocom/git_hub_bub.
- This is the doc site for github API for repos https://docs.github.com/en/rest/repos/repos.
- This is the doc site for github API for labels for a repo https://docs.github.com/en/rest/issues/labels#list-labels-for-a-repository.
- For now I think instead of trying to find and store ALL labels (which could get complicated if there's a lot of them) let's just work on storing those two
hacktoberfestandhacktoberfest-accepted. The database schema for repos will need to be updated to include this extra data, or another table created. - Make a page that makes a query to repos with those tags and displays them.
I think this is a big project it can be split into several PRs:
- [x] Code to query the API and update the database
- [ ] Code to pull it the repos with the tags from the database and render them via a view. Add a codetriage.com/hacktoberfest page
- [ ] Code to filter and sort those hacktoberfest projects by language (similar to homepage).
Could perhaps be split up other ways, but that's a rough start.
That last PR didn't totally close out the feature. Going to re-open.
@yez thanks again for your awesome PR. The code is scheduled and running. It looks like we have 513 projects participating:
RepoLabel.where(label: Label.where(name: "hacktoberfest")).count
D, [2022-10-05T15:58:31.922343 #26] DEBUG -- : (6.7ms) SELECT COUNT(*) FROM "repo_labels" WHERE "repo_labels"."label_id" IN (SELECT "labels"."id" FROM "labels" WHERE "labels"."name" = $1) [["name", "hacktoberfest"]]
=> 513
I made the other two remaining tasks a bit more clear at the bottom. Are you interested in them or it's okay if I hand them out?
I'd love to try and tackle them @schneems!
I know its been a week but I still plan to do this!
You still working or want me to open it up?
@schneems unfortunately my free time is less than I thought it would be so please feel to open this up! Thanks for your patience.
It looks like there's a lot of prior art. This PR was lost to the sands of time, but it might be good for inspiration: https://github.com/codetriage/CodeTriage/pull/677/files
Hello @schneems. I'm interested to work on this part if no one is currently working on it
Code to pull it the repos with the tags from the database and render them via a view. Add a codetriage.com/hacktoberfest page