MCPcopy Index your code
hub / github.com/azu/git-commit-push-via-github-api

github.com/azu/git-commit-push-via-github-api @1.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.2 ↗ · + Follow
6 symbols 12 edges 2 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

GitCommitPushOptions (Interface)
(no doc)
src/git-commit-push-via-github-api.ts

Core symbols most depended-on inside this repo

getReferenceCommit
called by 1
src/git-commit-push-via-github-api.ts
createTree
called by 1
src/git-commit-push-via-github-api.ts
createCommit
called by 1
src/git-commit-push-via-github-api.ts
updateReference
called by 1
src/git-commit-push-via-github-api.ts
gitCommitPush
called by 1
src/git-commit-push-via-github-api.ts

Shape

Function 5
Interface 1

Languages

TypeScript100%

Modules by API surface

src/git-commit-push-via-github-api.ts6 symbols

For agents

$ claude mcp add git-commit-push-via-github-api \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page