Get the SHA of a repo branch
Find the SHA of the HEAD of a given repo branch using Continuous Delivery’s /v1/vcs/branches API endpoint.
To find the SHA of the HEAD of a given repo branch, you can either find the commit in your VCS provider or you can use Continuous Delivery’s /v1/vcs/branches API endpoint. Here, project is used to refer to the owner/org of the repo for all providers except GitHub. If your repo comes from GitHub, you must supply either organization or owner instead, depending on whether the repo belongs to an individual or an organization.
Use your workspace ID to find the SHA.
auth_header="Authorization: <API Token>" uri="https://<CD4PE host>/cd4pe/api/v1/vcs/branch?workspaceId=<workspace ID>&provider=BITBUCKET&project=puppet&name=my_control_repo&branch=main curl --insecure --header "$auth_header" --request GET "$uri”
This returns information about the repo branch. For example, it might look similar to the following:
{ "name" : "main", "headSha" : "4c2f400a77cd73ebf67271361e1dd9b1102b43b4" }