github-raw-commits
Get all commit messages from a GitHub repository that match search criteria such as branch, since, or before, a tag, etc..
Commit messages are returned as an array of strings, each message in its raw form, where it may contain encoded newline characters.
For example, one commit message string may be: docs(README): add an introduction paragraph\nAdd introduction paragraph for the 'semantic-release-github' project.\nCloses #1\n\n
Table of Contents
Installation
To install github-raw-commits
for use in your project please run the following command:
yarn add github-raw-commits
Usage
Commits are fetched in reverse chronological order, starting with the commit pointed to by the reference, and going back to the first commit.
Fetching Commits on Default Branch
To fetch all commits on the default branch pass the path, the organization name plus repository name, as the path
property.
const githubRawCommits = require(`github-raw-commits`);
githubRawCommits({path: `org/repo`}).then(commitMessages => { /* array of raw commit messages */ });
Fetching Commits by Reference
Commits can also be fetched by reference, such as a branch name, tag name, or with a commit SHA. Just pass the value of the reference as the reference
property.
By branch:
const githubRawCommits = require(`github-raw-commits`);
githubRawCommits({path: `org/repo`, reference: `development`}).then(commitMessages => { /* array of raw commit messages */ });
By tag:
const githubRawCommits = require(`github-raw-commits`);
githubRawCommits({path: `org/repo`, reference: `13.0.0`}).then(commitMessages => { /* array of raw commit messages */ });
By commit SHA:
const githubRawCommits = require(`github-raw-commits`);
githubRawCommits({path: `org/repo`, reference: `8da5888ef6d25b614ee277914390a2f8a674e313`}).then(commitMessages => { /* array of raw commit messages */ });
Node Support Policy
We only support Long-Term Support versions of Node.
We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.
It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
As each Node LTS version reaches its end-of-life we will remove that version from the node
engines
property of our package's package.json
file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.
We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node
engines
property. If you encounter issues installing this package, please report the issue to your package manager.
Contributing
Please read our contributing guide on how you can help improve this project.