GithubHelp home page GithubHelp logo

azu / git-commit-push-via-github-api Goto Github PK

View Code? Open in Web Editor NEW
62.0 4.0 18.0 150 KB

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

License: MIT License

JavaScript 14.46% TypeScript 85.54%
git github commit api

git-commit-push-via-github-api's Introduction



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);
    });

Related

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.

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

Author

License

MIT © azu

git-commit-push-via-github-api's People

Contributors

azu avatar dependabot[bot] avatar madanbhandari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

git-commit-push-via-github-api's Issues

Error: token is not defined

Whenever I try to use this API, I put in my parameters in the gitCommitPush() function, and then I create an .env file, and put my token in like this:

GITHUB_API_TOKEN="hidden"

It will still return token is not defined

https-proxy-agent security vulnerability

One of dependency (https-proxy-agent ) on git-commit-push-via-github-api v1.0.1 has security vulnerability.

npm audit security report

                                                                                                                                                        
                                 Manual Review                                  
             Some vulnerabilities require your attention to resolve             
                                                                                
          Visit https://go.npm.me/audit-guide for additional guidance           
                                                                                
                                                                                
  High            Denial of Service                                             
                                                                                
  Package         https-proxy-agent                                             
                                                                                
  Patched in      >=2.2.0                                                       
                                                                                
  Dependency of   git-commit-push-via-github-api                                
                                                                                
  Path            git-commit-push-via-github-api > github > https-proxy-agent   
                                                                                
  More info       https://nodesecurity.io/advisories/593                        
                                                                                
found 1 high severity vulnerability in 1206 scanned packages
  1 vulnerability requires manual review. See the full report for details.

use of deprecated github api warning

I am getting this warning please fix it

[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
Deprecation: [@octokit/rest] octokit.authenticate() is deprecated. Use "auth" constructor option instead.
    at authenticate (D:\node_project\node_modules\@octokit\rest\plugins\authentication-deprecated\authenticate.js:11:5)
    at exports.gitCommitPush (D:\node_project\node_modules\git-commit-push-via-github-api\lib\git-commit-push-via-github-api.js:126:16)
    at D:\node_project\routes\notices\notification.js:199:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  name: 'Deprecation'
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.