Skip to content

feat: add popular repos query#5

Merged
bashbunni merged 9 commits intomasterfrom
org-stargazing
Jul 23, 2024
Merged

feat: add popular repos query#5
bashbunni merged 9 commits intomasterfrom
org-stargazing

Conversation

@bashbunni
Copy link
Copy Markdown

@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
Copy Markdown

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 Outdated
func popularRepos(count int, orgname string) []Repo {
fmt.Println("Finding popular repos...")

repos := make([]Repo, count)
Copy link
Copy Markdown
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
Copy Markdown

@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.

repos.go Outdated
}
}*/

var popularReposOrgQuery struct {
Copy link
Copy Markdown

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
Copy Markdown
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

@bashbunni
Copy link
Copy Markdown
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
Copy Markdown
Author

bashbunni commented Jul 16, 2024

main.go Outdated
funcMap["recentForks"] = recentForks
funcMap["recentReleases"] = recentReleases
funcMap["recentRepos"] = recentRepos
funcMap["orgPopularRepos"] = orgPopularRepos
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@bashbunni bashbunni requested a review from aymanbagabas July 17, 2024 16:42
Copy link
Copy Markdown
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
@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