0

So I have the data from https://api.github.com/repos/req-res/articles/readme, which my app can get, but I need the most recent author's username (archiebaer). This must be done client-side, so I do not want to search every commit in the repository for the file path preferably, as this could be detrimental to UX, but if it's the only way, that's okay.

Phrased as a question (in case you can't work out what I want): How can I get the most recent author's username?

1 Answers1

0

If by author you mean commit author which I believe this is what you're aiming at you will want to use the Commits API. Now I still don't know if you want the last commit author of the README.md file or just in general for the repo so:

You'll want to be using List commits on a repository endpoint and based on your requirements you can do a few query filters.

  1. You can filter by sha on the request to for example, only get commits on master
  2. If you just want commits for the README.md file then you also want to use the filter for path

If you want only master commits for the path README.md then you would combine both. There's more filters on that endpoint so I suggest you take a proper read before trying again.

Hope this helps.

bitoiu
  • 6,893
  • 5
  • 38
  • 60