Github api get SHA masters

I am looking for the SHA of the current github relay wizard.

If I do something like this: https://api.github.com/repos/ameyer/Arduino-L6470/git/trees/master

The returned SHA is the "master."

I need a way to check if the version of the wizard on github is newer than mine in the cached application, and I decided that SHA would be the best way to check.

+4
source share
1 answer

Try to get links:

https://api.github.com/repos/ameyer/Arduino-L6470/git/refs

And then you can:

https://api.github.com/repos/ameyer/Arduino-L6470/git/trees/d0cad097e733c3d9b7051c6f047411c5e3494491

Note that this second url gives basically the same result as the url you tried, only the name master ref is replaced with the actual value of the last commit.

So basically, just pick up refs and get sha of master.

+3
source

All Articles