How do I get my weekly activity history on GitHub for all repositories and branches as well as issues created, closed or otherwise participated in?

Viewed 144

I have been trying to find a way that I can show all of my own activity in the last week on GitHub. The activity feed of my profile only shows things that have made it to the main/master branches of repositories.

  1. Is there a way to view a weekly history for my profile that shows all repositories or branches?
  2. If no to the first question, then is there someway I could do this through the API?

Looking at each branch of each repository or even just each repository is somewhat useful but I would like to see everything.

I tend to write a brief status report of work and process overall as part of my job for the week on Fridays. I usually have issues remembering everything so things do get missed. I mostly get by with looking at what I was supposed to get done. This works fine but I do a lot of changes that do not end up on that list. Sometimes these things are related to code outside my organization that I had to create issues on or submit PRs to that benefit the organization and should at least end up on the list.

1 Answers

That would be through the Github V4 API, the GraphQL-based one, using a ContributionsCollection object.

You can see it used in this thread, but only for public contribution, not ones done for private repositories.

You can also get those through irevenko/octostats, which does include a ContributionsCollection structure, but also other methods like this example:

func GraphqlExamples(qlClient *githubv4.Client, user string) {
    langs, commits := g.LanguagesByCommit(qlClient, user, 2020, 2021)
    fmt.Println("\nLanguages by commit 2020-2021:")
    for i, v := range langs {
        fmt.Printf("%v : %v\n", v, commits[i])
    }

    allCommits := g.AllCommits(qlClient, user, 2020, 2021)
    fmt.Println("\nAll commits 2020-2021:")
    fmt.Println(allCommits)

    allPrs := g.AllPullRequests(qlClient, user, 2020, 2021)
    fmt.Println("\nAll pull requests 2020-2021:")
    fmt.Println(allPrs)
    ...
}
Related