Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maskaravivek/1116d1b11de4df4bd326f8a67e6e2b52 to your computer and use it in GitHub Desktop.
Save maskaravivek/1116d1b11de4df4bd326f8a67e6e2b52 to your computer and use it in GitHub Desktop.
const getShaForBaseTree = async (
githubAccessToken,
repoFullName,
branchName
) => {
const baseTreeResp = await fetch(
`https://api.github.com/repos/${repoFullName}/git/trees/${branchName}`,
{
method: "GET",
headers: {
Accept: "application/vnd.github+json",
Authorization: `Bearer ${githubAccessToken}`,
"X-GitHub-Api-Version": "2022-11-28",
},
}
);
const response = await baseTreeResp.json();
return response.sha;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment