Skip to content

leesei/github-commits-since-tag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 GitHub API requests, 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.

Reference

GitHub API v3 | GitHub Developer Guide

mikeal/contribution-reports: Tools for running contribution reports on GitHub repos and orgs.

About

Get commits since a tag with GitHub API

Resources

License

Stars

Watchers

Forks

Packages

No packages published