Hi there
I want to change the build status via REST API. So I use:
/2.0/repositories/{username}/{repo_slug}/commit/{node}/statuses/build
but, I have to provide {node}, which is "The commit's SHA1."
I've seen that I can get the commit's SHA1 using /2.0/repositories/{username}/{repo_slug}/commits.
But at no other place (that I could find). And there is no identifier of which pull request is which.
Is there a way to get a commit's SHA1 by pull request id?
EDIT: I found a way: /2.0/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/commits.
It lists the commits of a specific pull request. But I am interested in the latest one. can I be sure that the first commit in the list is the latest one?
The docs don't really say much about the commits this particular REST endpoint returns.
I'm sure if you test it you can figure out what it currently does, and there's a strong likelihood the current behaviour will be stable and reliable for a long time.
But if you're paranoid you could run all the commits it finds through this command (using a local clone):
git merge-base --independent <commits...>
That will return the "tip" commit among the commits supplied.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.