github-commits-since-tag

1.1.0 • Public • Published

github-commits-since-tag

js-semistandard-style

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:

  1. each tagging is followed by an npm publish (see npmpub)
  2. tagging follows SemVer, versions with meta are considered unofficial and ignored
  3. 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.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i github-commits-since-tag

    Weekly Downloads

    1

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • leesei