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
POST https://api.github.com/repos/{user}/{repo}/git/commits |
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 updateGithubBranchRef = async ( | |
githubAccessToken, | |
repoFullName, | |
branchName, | |
commitSha | |
) => { | |
const payload = { | |
sha: commitSha, | |
force: false, | |
}; |
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
PATCH https://api.github.com/repos/{user}/{repo}/git/refs/heads/{branch} |
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", | |
}, |
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
https://api.github.com/repos/${user}/{repo}/git/refs/heads/{branch} |
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 createGithubRepoTree = async ( | |
githubAccessToken, | |
repoFullName, | |
branchName, | |
articleFiles | |
) => { | |
const shaForBaseTree = await getShaForBaseTree( | |
githubAccessToken, | |
repoFullName, | |
branchName |
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
POST https://api.github.com/repos/{user}/{repo}/git/trees |
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 createGithubFileBlob = async ( | |
githubAccessToken, | |
repoFullName, | |
content, | |
encoding = "utf-8" | |
) => { | |
const blobResp = await fetch( | |
`https://api.github.com/repos/${repoFullName}/git/blobs`, | |
{ | |
method: "POST", |
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
POST https://api.github.com/repos/{user}/{repo}/git/blobs |
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 getShaForBaseTree = async ( | |
githubAccessToken, | |
repoFullName, | |
branchName | |
) => { | |
const baseTreeResp = await fetch( | |
`https://api.github.com/repos/${repoFullName}/git/trees/${branchName}`, | |
{ | |
method: "GET", | |
headers: { |