🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

git-commit-push-via-github-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-commit-push-via-github-api

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

1.0.2
latest
Source
npm
Version published
Weekly downloads
76
Maintainers
1
Weekly downloads
 
Created
Source

git-commit-push-via-github-api

Git commit and push by using GitHub API.

No depended on Git binary.

Install

Install with npm:

npm install git-commit-push-via-github-api

Usage

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({
    // commit to https://github.com/azu/commit-to-github-test
    owner: "azu",
    repo: "commit-to-github-test",
    // commit files
    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",
    forceUpdate: false, // optional default = false
    commitMessage: "HELLO"
})
    .then(res => {
        console.log("success", res);
    })
    .catch(err => {
        console.error(err);
    });

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

GITHUB_API_TOKEN=xxx npm run test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request :D

Author

License

MIT © azu

Keywords

git

FAQs

Package last updated on 11 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts