Skip to content

Sourcehut support #77

@Zeviraty

Description

@Zeviraty

Adding sourcehut support should be possible, getting all commits of a user is impossible (atleast i think so)
but getting all of the commits in their own repos is possible.

Graphql query:

query {
  me {
    repositories(filter: { count: 100 }) {
      results {
        log {
         cursor
         results {
          author {
          	email
            time
          }
         }
        }
      }
    }
  }
}

curl command:

echo '{
    "query": "query {\r\n  me {\r\n    repositories(filter: { count: 100 }) {\r\n      results {\r\n        log {\r\n         cursor\r\n         results {\r\n          author {\r\n          \temail\r\n            time\r\n          }\r\n         }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n",
    "variables": {}
}' | curl --json @- \
    --oauth2-bearer "$bearer_token" \
    https://git.sr.ht/query

You should enumerate over result["data"]["me"]["repositories"]["results"]
and in each repo enumerate over repo["log"]["results"] and if repo["log"] has a cursor that is not null, you should also go to the next page.
and in each one of THOSE check if commit["author"]["email"] is equal to the user, and then you can take the time with commit["author"]["time"]

It is a lot, and a very nested dict. but it should be possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions