Closed iamdanfox closed 10 years ago
Oh man Octokit looks great...
Write multiple files (update or add) in one commit
var repo = gh.getRepo(username, reponame);
var branch = repo.getBranch("BRANCH_NAME");
var contents = {
"FILE1.txt": "Contents of the file",
"FILE2.txt": {isBase64: true, content: "BASE_64_ENCODED_STRING"}
}
branch.writeMany(contents, message)
.then(function() {});
(Would need lots of .thens
to work properly)
Running with github.js.
Need to figure out a nice way to keep a connection to the github api running alongside selected stuff, even if the user hasn't logged in with OAuth!
So close... The write
method is failing to send a valid author {name, email}
to github.
If I manually change the .commit
function
https://github.com/michael/github/blob/master/github.js#L412
"author": {
"name": options.user,
"email": "iamdanfox@gmail.com"
},
Everything works
https://developer.github.com/v3/git/commits/#create-a-commit
Using the manual API, it seems like we'd need to create and save a blob, then update the tree, then create a commit...
It may be worth using an API wrapping library like Octokit.js instead.