NodeJS script to count a GitHub user's contributions.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
ghlc.js
package.json

README.md

github-line-counter

Node script to count a GitHub user's contributions.

This script calculates the total number of additions, deletions, and commits by a user (in selected repositories) and outputs the result to a json file, automatically updating twice per day. This file can be read by other Node scripts or PHP to display the result.

You must slightly modify the constants at the top of the script, including setting your username, optionally password or Personal Access Token (only to allow more than 60 API requests per hour), and which repositories to scan. (Remove the "etc." in the repositories array, that's there to force you to modify the script before it'll run!)

The default output is to a file ghlc.out in the same directory as the script, but this can be changed. The output format is the following JSON:

{
  "a":<additions>,
  "d":<deletions>,
  "c":<commits>,
  "requests":<number of repositories requested>,
  "responses":<number of repositories that data was successfully retrieved from>
}

If responses is less than requests, then an error occurred and maybe you should display "More than" before displaying the results on screen.