Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

lyne-design-system/lyne-helper-trigger-travis

Repository files navigation

Build Status semantic-release GitHub tag (latest SemVer)

Lyne Helper Trigger Travis

Trigger a build on TravisCI via Travis API v3.

Installation

Install the Helper with the following command:

npm install --save lyne-helper-trigger-travis

Usage

Require the module:

const triggerTravis = require('lyne-helper-trigger-travis');

Build up your config:

const config = {
  branchName: 'BRANCH_NAME',
  message: 'MESSAGE',
  travisToken: 'TRAVIS_TOKEN',
  travisUrl: 'TRAVIS_URL'
};

The module has a single method which returns a promise. You can use it as follows:

triggerTravis(config)
  .then((data) => {
    if (data) {
      console.log(data);
    }
  })
  .catch((err) => {
    console.log(err);
  });

Config

branchName: the branch on which the job should trigger

message: the message which acts as the commit message for the build

travisToken: the access token from your travis account

travisUrl: the url to the travis project.

travisUrl

If you use travis.com, please use https://api.travis-ci.com/repo/{slug|id}/requests.

Example for a project on travis.com with the user name lyne-design-system and the repo name lyne-design-tokens: https://api.travis-ci.com/repo/lyne-design-system%2Flyne-design-tokens/requests

Development

Conventional Commits

Please follow the Conventional Commits specification to make sure we can automatically determine the next release version if necessary.

Deployment

The package is automatically versioned and published to npm after successfull build on travis.

Debugging

If there is something wrong or weird with the Travis API, you can try to trigger a Travis Job directly via CLI with the following command:

body='{
  "request": {
    "branch":"master"
  }
}'

curl -s -X POST \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Travis-API-Version: 3" \
  -H "Authorization: token TRAVIS-TOKEN-HERE" \
  -d "$body" \
  https://api.travis-ci.com/repo/lyne-design-system%2Flyne-documentation/requests