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

Same as issues/discussions for a repo but for a user only #9213

Closed
andry81 opened this issue May 29, 2023 · 13 comments · Fixed by #9340
Closed

Same as issues/discussions for a repo but for a user only #9213

andry81 opened this issue May 29, 2023 · 13 comments · Fixed by #9340
Assignees
Labels
good first issue New contributors, join in! service-badge Accepted and actionable changes, features, and bugs

Comments

@andry81
Copy link

andry81 commented May 29, 2023

📋 Description

Add links of number of issues/discussions just for a user only.

🔗 Data

issues by user: https://github.com/issues?q=author%3Aandry81+sort%3Aupdated-desc+
discussions by user: https://github.com/discussions?q=author%3Aandry81+sort%3Aupdated-desc+

Both links need a login.

🎤 Motivation

Put it as a statistic in the main page readme file: user/user

@andry81 andry81 added the service-badge Accepted and actionable changes, features, and bugs label May 29, 2023
@chris48s
Copy link
Member

If someone is interested in working on this, the GraphQL queries for this would be

{
  user(login: "andry81") {
    issues {
      totalCount
    }
  }
}
{
  user(login: "andry81") {
    repositoryDiscussions {
      totalCount
    }
  }
}

@chris48s chris48s added the good first issue New contributors, join in! label May 29, 2023
@jNullj
Copy link
Collaborator

jNullj commented Jun 24, 2023

you could assign me and i will get to it in a few days or so

@jNullj
Copy link
Collaborator

jNullj commented Jul 1, 2023

I wanted to add this and i first looked for a shield to add it to before creating something new.
While searching i noticed you can already create this shield using the git-hub-issue-custom-search shield:
Example of issues by abdry81: GitHub issue custom search
Using this url: https://img.shields.io/github/issues-search?query=author%3Aandry81&label=issues%20by%20andry81
I used the link you provided and counted the issues, and the numbers fit (181 issues opened by andry81 to date)

@andry81 Please let me know if this solves the first issue for displaying user created issues or you still want us to discuss adding a new shield/option?

Regarding discussions across repositories I could not find a way to implement this with existing shields. I think it would be best to add this in a new shield.
@chris48s I think that instead of creating a specific shield for all discussions by author it will be much better to add a non-repo specific discussion custom search.

I could for example use the search query with discussion as search type for this type of shield similar to issues costume search

query ($query: String!) {
  search(query: $query, type: DISCUSSION) {
    discussionCount
  }
 }

Please provide me with feedback what would better fit the project so i could implement the solution.

@jNullj
Copy link
Collaborator

jNullj commented Jul 1, 2023

Well here is a quick preview
image
image

Created the discussion badge you you wanted in my new branch using:
http://localhost:8080/github/discussions-search?query=author%3Aandry81&label=discussions%20by%20andry81
image

jNullj added a commit to jNullj/shields-fun-fork that referenced this issue Jul 1, 2023
This commit adds a GitHub Discussions custom search service in the github-discussions-custom-search.service.js file. It includes classes for global discussions search (GithubDiscussionsSearch) and repository-specific discussions search (GithubRepoDiscussionsSearch). Users can now search discussions with custom queries and retrieve the discussion count.

Fixes badges#9213
@jNullj
Copy link
Collaborator

jNullj commented Jul 1, 2023

I ended up adding this, i think that its good to have regardless of the original issue.
I could implement a new service from the BaseGithubDiscussionsSearch if you think there is an advantage of making a specific user discussion count more accessible. But using this new service you can create the desired badge and many others.

@andry81
Copy link
Author

andry81 commented Jul 1, 2023

@jNullj Thanks for the effort! One more thing here is that the issues and discussions is not reachable from a not logged in page. May be add a second icon to indicate that the badge url requires the GitHub login? Or may be add a second line of text like login required?

@jNullj
Copy link
Collaborator

jNullj commented Jul 1, 2023

do you refer to GitHub API token? I just tested and you are right, i could not make requests without one altho the API should have a small rate limit for calls without a token.
Do you have an example of such message or should i get creative?

@andry81
Copy link
Author

andry81 commented Jul 1, 2023

I've meant the simple url in the readme file: https://github.com/issues?q=author%3Aandry81+sort%3Aupdated-desc+

@jNullj
Copy link
Collaborator

jNullj commented Jul 1, 2023

Not sure what readme file you refer to, i never added those urls in my pull request and I don't see why they should be added.
Also you can access the same information without a login using those links:

@andry81
Copy link
Author

andry81 commented Jul 1, 2023

@jNullj Thank you! This is what I was looking for.

jNullj added a commit to jNullj/shields-fun-fork that referenced this issue Jul 1, 2023
This commit adds a GitHub Discussions custom search service in the github-discussions-custom-search.service.js file. It includes classes for global discussions search (GithubDiscussionsSearch) and repository-specific discussions search (GithubRepoDiscussionsSearch). Users can now search discussions with custom queries and retrieve the discussion count.

Fixes badges#9213
@andry81
Copy link
Author

andry81 commented Jul 1, 2023

It would be useful if add a badge for the commits too: https://github.com/search?q=author%3Aandry81&type=commits&s=author-date&o=desc

@jNullj
Copy link
Collaborator

jNullj commented Jul 1, 2023

I can add this in a seperate PR as a new service for 'commit custom search'. But lets wait to see what the maintainers think about the changes i added so far and those changes as well. I want to avoid making too much changes without knowing they will not get rejected.

jNullj added a commit to jNullj/shields-fun-fork that referenced this issue Jul 7, 2023
This commit adds a GitHub Discussions custom search service in the github-discussions-custom-search.service.js file. It includes classes for global discussions search (GithubDiscussionsSearch) and repository-specific discussions search (GithubRepoDiscussionsSearch). Users can now search discussions with custom queries and retrieve the discussion count.

Fixes badges#9213
repo-ranger bot pushed a commit that referenced this issue Jul 7, 2023
…#9340)

* Add GitHub Discussions custom search service

This commit adds a GitHub Discussions custom search service in the github-discussions-custom-search.service.js file. It includes classes for global discussions search (GithubDiscussionsSearch) and repository-specific discussions search (GithubRepoDiscussionsSearch). Users can now search discussions with custom queries and retrieve the discussion count.

Fixes #9213

* Add tester to GithubDiscussionsSearch

* Add documentation for GithubDiscussionsSearch

Inform users of filters and query values for the free search.

* Update GithubDiscussionsSearch examples

Change examples from filter by author to `filter` by `answered-by` as this has higher change of being a more common use case.

* fix typo

---------

Co-authored-by: jNullj <jNullj@users.noreply.github.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
@jNullj
Copy link
Collaborator

jNullj commented Jul 7, 2023

It would be useful if add a badge for the commits too: https://github.com/search?q=author%3Aandry81&type=commits&s=author-date&o=desc

I can add this with the an REST api call, the GraphQL does not support commit search (yet?).
Please reopen this issue or make another one so we can track this, just to make sure i understand what you are asking for, you want a badge that will show total commit across all repositories by you?
Take into account the api has some limitations regarding the maximum number of repositories it will search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue New contributors, join in! service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants