muesli / markscribe

Your personal markdown scribe with template-engine and Git(Hub) & RSS powers 📜

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Latest releases I've contributed to" is fetching (partially) wrong data

andygrunwald opened this issue · comments

Thanks a lot for this project (and also muesli/readme-scribe.

I have started to use the existing template for my README:

Screen Shot 2022-01-25 at 17 07 17

Having a look at the "Latest releases" section, I am using this snippet:

### 🔭 Latest releases I've contributed to

{{range recentReleases 5}}
- [{{.Name}}]({{.URL}}) ([{{.LastRelease.TagName}}]({{.LastRelease.URL}}), {{humanize .LastRelease.PublishedAt}}) - {{.Description}}
{{- end}}

For the project rabbitmq/amqp091-go, I did not contribute to the v1.3.0 release:
See rabbitmq/amqp091-go@v1.2.0...v1.3.0
I did contribute to the current main version that is not released yet.
See rabbitmq/amqp091-go@v1.3.0...main

The same for google/go-github v42.0.0
See google/go-github@v41.0.0...v42.0.0

It seem to be that the data is not as accurate as expected.
Or is there more meaning to "recent contribution" than a code commit?

recentReleases is handled by this function:

Releases QLRelease `graphql:"releases(first: 10, orderBy: {field: CREATED_AT, direction: DESC})"`

Github's GraphQL endpoint repositoriesContributedTo returns only repository which you've contributed to, but not the exact commit or release info. And then the latest release of this repo is fetched, regardless of your contribution.

Actually, fetching the exact release you've contributed to is not a trivial task.

Firstly, it is need to fetch all repos you've contributed to.
Then get all the commits made by you into this repo.
And then find release which includes any of these commits.

But it seems that Github's GraphQL API does not support that.
commitContributionsByRepository can return only commits count you've made to a repo, not the exact commits list. And there is no option to iterate over all the commits of current repo to find the one you need.

Also ReleaseConnection.releases endpoint does not support filtering the data by commit ids. It is only possible to iterate all the releases, and get tagCommit of each of them. And then a tree of all commit parents should be iterated to determine if your commit is included to this release or not.

So it looks like this task is impossible to implement with Github's API.

Thanks for the detailed response @dolfinus. This totally makes sense.
Reading this makes me think if we should improve the wording of the README: https://github.com/muesli/markscribe#recent-releases-you-contributed-to
Because "Releases you contributed to" might be a misleading term, considering the background of how the data is fetched.

What do you think?