21

Actually you can go https://github.com/ORG_NAME/REPO_NAME/commits?author=USER_NAME and get all the commits authored by USER_NAME on the repo ORG_NAME/REPO_NAME, but I want get all commits of all repos.

3
  • 2
    There's no way to do this in the github app right now. Jan 8, 2014 at 23:18
  • @Muhammad Thanks. If you reply in form of answer I could select it.
    – user29868
    Jan 9, 2014 at 0:22
  • If the user in question is yourself, you can see a list of all repositories you've contributed to in the sidebar on the right of the GitHub home page when you're signed in. Though a bit cumbersome, you could go to https://github.com/ORG_NAME/REPO_NAME/commits?author=USER_NAME for each repo in that list. That would be a complete listing.
    – Ajedi32
    Nov 10, 2016 at 22:26

5 Answers 5

1

There's no way to do this on Github.com right now.

22

You can now do this by prepending the prefix "author:" to a username in the search box. Or modify and use this URL directly: https://github.com/search?q=author:the_username

2
  • Does not seem to work for me. I got no commits for users that are not me.
    – jjxtra
    Oct 24, 2022 at 20:19
  • To be specific to the author's question, you can add type=commits to the end of the URL to go right to the commits, i.e. https://github.com/search?q=author:USERNAME&type=commits Sep 20, 2023 at 18:28
0

On enterprise github you can look at http://github.EXAMPLE.com/orgs/ORG/dashboard, and change the personal context to the ORG of interest to see everyone's activity (pushes, merges, etc.) If you don't change the context, you don't see your own activity in the feed.

0

As answered from here: https://stackoverflow.com/questions/20714593/github-api-repositories-contributed-to/47564252#47564252

you can use GraphQL to request at least a list: GraphQL Explorer

# This first page includes an `endCursor' to be used for the next request
query { 
  viewer {
    repositoriesContributedTo(first: 100, contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]) {
      pageInfo {
        startCursor
        hasNextPage
        endCursor
      }
      nodes {
        nameWithOwner
      }
    }
  }
}

Output example:

{
  "data": {
    "viewer": {
      "repositoriesContributedTo": {
        "pageInfo": {
          "startCursor": "Y3Vyc29yOnYyOpHOAAFPwQ==",
          "hasNextPage": false,
          "endCursor": "Y3Vyc29yOnYyOpHOIJAKjQ=="
        },
        "nodes": [
          {
            "nameWithOwner": "user/repo"
          },
          ...
       ]
      }
    }
  }
}
# This is an example of getting the next page.
# Stop getting pages when `hasNextPage` is not `true`
query { 
  viewer {
    repositoriesContributedTo(first: 100, after: "Y3Vyc29yOnYyOpHOIJAKjQ==", contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]) {
      pageInfo {
        startCursor
        hasNextPage
        endCursor
      }
      nodes {
        nameWithOwner
      }
    }
  }
}

Note: The after field must be replaced by the output value in the endCursor field from the first query.

But nevertheless, you still would have a mixed result if want to query only a user commits repositories without repositories with only user issues: https://stackoverflow.com/questions/20714593/github-api-repositories-contributed-to/47564252#comment123285323_47564252

2
  • The link no longer works. Can you provide the original query?
    – coolaj86
    Jan 17, 2023 at 21:43
  • @coolaj86 Seems you must be logged into GitHub and grant GraphQL to access your profile.
    – Andry
    Jan 18, 2023 at 19:09
0

A Best Effort mix of GitHub v3 and v4 APIs

I created how-github-am-i which uses a combination of the GitHub v3 API for PRs and the GitHub v4 API for recent contributions.

It requires

  • GitHub Personal Access Token
  • jq
  • POSIX-ish shell (i.e. Bash)

And will spit out output like this:

caddyserver/caddy:
http://www.github.com/caddyserver/caddy/commits?author=coolaj86

watchexec/watchexec:
http://www.github.com/watchexec/watchexec/commits?author=coolaj86

webinstall/webi-installers:
http://www.github.com/webinstall/webi-installers/commits?author=coolaj86

That at least gives you a top-level view of repositories for which a PR has been closed, or you have verified commits.

It's a best-effort solution with the available tools.

How is it done?

If you wanted to reimplement the paging yourself, here's the basic building blocks:

v4 Recent Contributions

# get the GraphQL Query without spaces
my_query="$(echo $(echo '
    query {
      viewer {
        repositoriesContributedTo(
            first: 100,
            '"${my_after:-}"'
            contributionTypes: [
                COMMIT,
                PULL_REQUEST,
                REPOSITORY
            ]
        ) {
          pageInfo {
            startCursor
            hasNextPage
            endCursor
          }
          nodes {
            nameWithOwner
          }
        }
      }
    }
'))"

curl -fsSL -X POST https://api.github.com/graphql \
    -H 'Content-Type: application/json' \
    -H "Authorization: bearer ${GITHUB_TOKEN}" \
    -d '{"query": "'"${my_query}"'"}'

v3 Closed PRs

# get the login name by the token
my_user="$(
    curl -fsSL https://api.github.com/user \
        -H "Accept: application/vnd.github+json" \
        -H "Authorization: Bearer ${GITHUB_TOKEN}" \
        -H "X-GitHub-Api-Version: 2022-11-28" |
        jq -r .login
)"
curl -sSL --get "https://api.github.com/search/issues" \
    -H "Authorization: bearer ${GITHUB_TOKEN}" \
    --data-urlencode "q=type:pr state:closed author:${my_user}" \
    --data-urlencode "per_page=100" \
    --data-urlencode "page=${my_page}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.