Sourcehut support
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
Thanks for raising the issue, will have a look on improving sourcehut integration.
because at the moment it is broken: (after giving a correct token, or no token)
Could not get authenticated user: Token required for Sourcehut authentication Please ensure you have a valid token configured Error: Initialization failed
or with token
Could not get authenticated user: Could not get authenticated user: 403 Client Error: Forbidden for url: https://git.sr.ht/graphql Please ensure you have a valid token configured Error: Initialization failed
The problem was that you were trying to call the graphql api at /graphql while it is at /query
after changing that i run into:
Error: Sourcehut API request failed: 422 Client Error: Unprocessable Entity for url: https://git.sr.ht/query
oh uh forgot to say this but i created this quickly to try: https://git.sr.ht/~zevvi/sourcefetch You can take inspo from this