Content API in GitHub #24479
-
Github content api is not giving the correct commit id in its ‘sha’ key value.
I’am using the above api and the sha key value is wrong. the result of api call is :
how to get the latest comimit for each file? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @anvinraj, Thanks for being here! Are you getting the last event? ie: the last push event: Most recent commit done (on any branch), pushed by a user to the repo. |
Beta Was this translation helpful? Give feedback.
-
No, it is not showing the latest push details(commit id). |
Beta Was this translation helpful? Give feedback.
-
Hi @anvinraj, For The Commits API, there’s an endpoint for fetching a list of commits on a repository. You could utilize the https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository Example: https://api.github.com/repos/github/linguist/commits?sha=dev If you’re interested in fetching every commit, I recommend leveraging pagination as well: https://developer.github.com/v3/#pagination I hope this helps |
Beta Was this translation helpful? Give feedback.
Hi @anvinraj,
For The Commits API, there’s an endpoint for fetching a list of commits on a repository. You could utilize the
sha
value to start listing commits from a specific SHA or branch:https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
Example:
https://api.github.com/repos/github/linguist/commits?sha=dev
If you’re interested in fetching every commit, I recommend leveraging pagination as well:
https://developer.github.com/v3/#pagination
I hope this helps