Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions script/helpers/git-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export async function getTree(owner, repo, ref) {
}

// https://docs.github.com/rest/reference/git#get-a-blob
export async function getContentsForBlob(owner, repo, blob) {
export async function getContentsForBlob(owner, repo, sha) {
const { data } = await github.git.getBlob({
owner,
repo,
file_sha: blob.sha,
file_sha: sha,
})
// decode blob contents
return Buffer.from(data.content, 'base64')
Expand All @@ -89,7 +89,13 @@ export async function getContents(owner, repo, ref, path) {
ref,
path,
})
// decode contents

if (!data.content) {
const blob = await getContentsForBlob(owner, repo, data.sha)
// decode Base64 encoded contents
return Buffer.from(blob, 'base64').toString()
}
// decode Base64 encoded contents
return Buffer.from(data.content, 'base64').toString()
} catch (err) {
console.log(`error getting ${path} from ${owner}/${repo} at ref ${ref}`)
Expand Down