0.1.2 • Published 7 years ago

github-data v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

GitHub Data

Build Status Coverage Status

NPM

This is essentially a Node.js interface to make low-level git calls through the GitHub Git Data API.

Docs are in the docs folder. Here's a simple example of how to use it.

Low level git plumbing objects are available to do pretty much whatever you want with. There is also a GitFile inteface that tries to simplify some things. But it has only been tested with files in the root directory of the repository.

var GitData = require('./index');
var username = process.env['GH_USERNAME'];
var authToken = process.env['GH_PASSWORD'];

var gdata = new GitData(username, authToken, "numenta", "experiments");

gdata.getBranch("master", function(err, master) {
    console.log('branch: ' + master.ref);

    master.getFile('temp.txt', function(err, file) {
        console.log(file);
        file.blob.setContents(file.blob.getContents() + '\nUpdated on: ' + new Date());
        file.commit('Updated through GitFile interface.', function(err, commit) {
            // Still have to push the new commit.
            master.push(commit, function(err) {
                console.log('push done!');
                master.getCommit(function(error, latestCommit) {
                    console.log(latestCommit);
                });
            });
        });
    });

});
0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

8 years ago

0.0.2

9 years ago

0.0.1

9 years ago