Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Oct 22, 2017
1 parent a683080 commit 64f2e40
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sudo: false
language: node_js
node_js: "stable"
script:
- npm run build
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# git-commit-push-via-github-api

Git commit and push by using GitHub API. No depended Git binary.
Git commit and push by using GitHub API.

No depended on Git binary.

## Install

Expand All @@ -10,12 +12,46 @@ Install with [npm](https://www.npmjs.com/):

## Usage

- [ ] Write usage instructions
```js
const fs = require("fs");
const { gitCommitPush } = require("git-commit-push-via-github-api");
process.on("unhandledRejection", console.dir);
if (!process.env.GITHUB_API_TOKEN) {
throw new Error("GITHUB_API_TOKEN=xxx node example.js");
}
gitCommitPush({
user: "azu",
repo: "commit-to-github-test",
files: [
{ path: "README.md", content: fs.readFileSync(__dirname + "/README.md", "utf-8") },
{ path: "dir/input.txt", content: fs.readFileSync(__dirname + "/dir/input.txt", "utf-8") },
// Pass binary as Buffer
{ path: "next-item.mp3", content: fs.readFileSync(__dirname + "/next-item.mp3") },
{ path: "image.png", content: fs.readFileSync(__dirname + "/image.png") }
],
fullyQualifiedRef: "heads/master", //optional default = "heads/dev"
forceUpdate: false, //optional default = false
commitMessage: "HELLOW" //option default = "AutoCommit - " + new Date().getTime().toString();
})
.then(res => {
console.log("success", res);
})
.catch(err => {
console.error(err);
});
```


## Related

- [Ramshackle-Jamathon/commit-to-github: make commits to github without git, perfect for AWS lambda](https://github.com/Ramshackle-Jamathon/commit-to-github)
- [wuzhizhe/uploadFileToGithub](https://github.com/wuzhizhe/uploadFileToGithub)

## Changelog

See [Releases page](https://github.com/azu/git-commit-push-via-github-api/releases).


## Running tests

Install devDependencies and Run `npm test`:
Expand Down

0 comments on commit 64f2e40

Please sign in to comment.