Created
July 15, 2023 07:30
-
-
Save maskaravivek/8c19a12c97392e5ed7c4a67c2fe60656 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getParentSha = async (githubAccessToken, repoFullName, branchName) => { | |
const parentResp = await fetch( | |
`https://api.github.com/repos/${repoFullName}/git/refs/heads/${branchName}`, | |
{ | |
method: "GET", | |
headers: { | |
Accept: "application/vnd.github+json", | |
Authorization: `Bearer ${githubAccessToken}`, | |
"X-GitHub-Api-Version": "2022-11-28", | |
}, | |
} | |
); | |
const response = await parentResp.json(); | |
return response.object.sha; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment