clangd/.github/actions/pick/node_modules/last-successful-gh-commit
Kirill Bobyrev 504e724a5b
Install action dependencies directly into node_modules
This allows skipping `npm install` step in the workflow and enables
other projects to use the step without copying/cloning the code.

https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/creating-a-javascript-action#commit-tag-and-push-your-action-to-github
2020-10-02 12:49:40 +02:00
..
build Install action dependencies directly into node_modules 2020-10-02 12:49:40 +02:00
CHANGELOG.md Install action dependencies directly into node_modules 2020-10-02 12:49:40 +02:00
LICENSE.md Install action dependencies directly into node_modules 2020-10-02 12:49:40 +02:00
package.json Install action dependencies directly into node_modules 2020-10-02 12:49:40 +02:00
README.md Install action dependencies directly into node_modules 2020-10-02 12:49:40 +02:00

Get last successful GitHub commit

last-successful-gh-commit

To achieve something similar to GIT_PREVIOUS_SUCCESSFUL_COMMIT env var defined by Git Plugin on Jenkins.

Table of Contents

Install

Node.js v6.5 or newer is required.

Via the yarn client:

$ yarn add --dev last-successful-gh-commit

Via the npm client:

$ npm install --save-dev last-successful-gh-commit

Example

import getLastSuccessfulGHCommit from 'last-successful-gh-commit';

const owner = 'ramasilveyra';
const name = 'last-successful-gh-commit';
const token = process.env.GH_TOKEN;

getLastSuccessfulGHCommit({ owner, name, token })
  .then(commit => {
    console.log('Last successful commit: ', commit);
  })
  .catch(err => {
    console.error('No successful commit found', err);
  });

Usage

getLastSuccessfulGHCommit(options)

options

Type: Object
Required

options.owner

Type: string
Required

Owner of the repository.

options.name

Type: string
Required

Name of the repository.

options.token

Type: string
Required

GitHub token with repo scope.

Contribute

Feel free to dive in! Open an issue or submit PRs.

last-successful-gh-commit follows the Contributor Covenant Code of Conduct.

License

MIT