user4399732
user4399732

Reputation:

Get the latest update time of a specific folder in a repo using Github API

How can I get the latest update time of a specific folder in a repo using Github API?

I've tried https://api.github.com/repos/User/Repo/contents

but it did not return any information about the latest update time.

or is it impossible for Github to do it?

Upvotes: 1

Views: 607

Answers (1)

Ivan Zuzak
Ivan Zuzak

Reputation: 18782

You can fetch the list of commits for that path with the Commits API:

https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository

If you look at the first commit in the returned list, that's the most recent commit which modified something in that folder. The date on which the commit was created is what you're looking for.

Upvotes: 1

Related Questions