github-commits-since-tag
v1.1.0
Published
Get commits since a tag with GitHub API
Downloads
1
Readme
github-commits-since-tag
Get commits of GitHub repo since the last version tag with GitHub API.
Equivalent to this in a local git repo:
git log <yourlasttag>..HEAD
Why?
When there are many small (possibly inter-dependent) repos, we may forgot to tag and publish the repos after commits and PR.
This library list the commits since the last tagging. We can then evaluate the commits and determine whether we should create a new release for the repo.
I assume:
- each tagging is followed by an
npm publish
(seenpmpub
) - tagging follows SemVer, versions with meta are considered unofficial and ignored
- forks are not to be tracked
Install
npm i github-commits-since-tag
Usage
GitHub imposes a per IP rate limit on the calling of GitHub API, you need a Personal access tokens to enjoy higher rates. A token with no specific role should suffice.
// instance creation
const GHcst = require('github-commits-since-tag');
const ghcst = new GHcst({
user: 'GitHub username',
token: 'GitHub token'
});
// list specific repo (accessibility depends on token)
// rejected upon invalid repo, forked repo, repo without tag
ghcst.commitsForRepo('github/hub')
.then(result => console.log(result))
.catch(err => console.log(err));
// list all repo (accessibility depends on token)
// ignore forked repo, repo without tag
ghcst.commitsForOwner('github')
.then(results => console.log(results))
.catch(err => console.log(err));
Debug logs
Supported DEBUG tags: ghcst:flow, ghcst:data.
See visionmedia/debug for details.