import type { Octokit } from "@octokit/core" ; import type { File } from "./types" ; export async function valueToTreeObject ( octokit , owner , repo , path , value ) { let mode = "100644" ; if ( value !== null && typeof value !== "string" ) { mode = value . mode || mode ; } if ( typeof value === "string" ) { return { path , mode : mode , content : value , } ; } const { data } = await octokit . request ( "POST /repos/{owner}/{repo}/git/blobs" , { owner , repo , ... value , } ) ; const blobSha = data . sha ; return { path , mode : mode , sha : blobSha , } ; }