Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add popular repos query #5

Merged
merged 9 commits into from
Jul 23, 2024
Merged

feat: add popular repos query #5

merged 9 commits into from
Jul 23, 2024

Conversation

bashbunni
Copy link
Member

@bashbunni bashbunni commented Jul 10, 2024

goal: support finding the most popular projects for an organization
used here: https://github.com/charmbracelet/.github/blob/stargazing/profile/README.md & https://github.com/charmbracelet/.github/blob/stargazing/templates/README.md.tpl#L13

todos:

  • update README with usage example for this query

@coveralls
Copy link

coveralls commented Jul 10, 2024

Pull Request Test Coverage Report for Build 9963614533

Details

  • 0 of 36 (0.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
main.go 0 2 0.0%
template.go 0 4 0.0%
repos.go 0 30 0.0%
Totals Coverage Status
Change from base Build 9962721687: 0.0%
Covered Lines: 0
Relevant Lines: 494

💛 - Coveralls

repos.go Show resolved Hide resolved
repos.go Outdated
func popularRepos(count int, orgname string) []Repo {
fmt.Println("Finding popular repos...")

repos := make([]Repo, count)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, this totally broke it last night 🙃 reverting to prev changes fixes it

Copy link

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this feature.

main.go Show resolved Hide resolved
repos.go Outdated
}
}*/

var popularReposOrgQuery struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var popularReposOrgQuery struct {
var popularOrgReposQuery struct {

It sounds better to me, but I might be wrong

@bashbunni
Copy link
Member Author

I thiiink this would be better as a method for the Org struct. More legible + organized, so that'll be the next step here

it would look something like:
{{.Org.PopularRepos "charmbracelet" 10}}, then the names can be simplified. A lot of this was originally written for a single user, would be nice to separate the org-specific functions this way

README.md Show resolved Hide resolved
@bashbunni
Copy link
Member Author

fwiw my original proposal to make these functions easier to reuse between user and organization will take some refactoring, but for right now we just need it to work. Would be fun to refactor this down the line though

@bashbunni bashbunni marked this pull request as ready for review July 16, 2024 18:12
@bashbunni
Copy link
Member Author

bashbunni commented Jul 16, 2024

main.go Outdated
funcMap["recentForks"] = recentForks
funcMap["recentReleases"] = recentReleases
funcMap["recentRepos"] = recentRepos
funcMap["orgPopularRepos"] = orgPopularRepos
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not specific for organizations though, you should be able to use it for users as well. I would rename it to popularRepos

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or userPopularRepos

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah hold on, I finally figured out how to make this work for users and orgs 🎊 I'll update the query + solution across the board here. Thanks for the nudge :)

@aymanbagabas aymanbagabas changed the title feat: add popular repos org query feat: add popular repos query Jul 16, 2024
Copy link
Member

@aymanbagabas aymanbagabas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work @bashbunni !

@bashbunni bashbunni merged commit 50643a9 into master Jul 23, 2024
9 checks passed
@bashbunni bashbunni deleted the org-stargazing branch July 23, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants