Via Github's API, I want to commit a file that is nested 2 files deep i.e. .github/workflows/main.yaml.
When I do the following, I get a 404 not found error response
const createTree = ({
ownerName,
repoName,
masterSha,
sha
}) => {
return axios.post(`https://api.github.com/repos/${ownerName}/${repoName}/git/trees`, {
base_tree: masterSha,
tree: [
{
path: ".github/workflows/main.yaml",
mode: "100644",
type: "blob",
sha
}
]
})
})
If I set path to workflows/main.yaml it seems to work fine.
How do I create a tree within subdirectories?