0.1.0 • Published 7 years ago

gitlab-ci-variables v0.1.0

Weekly downloads
210
License
MIT
Repository
gitlab
Last release
7 years ago

GitLab CI Variables

A package which parses the predefined variables set by GitLab CI, providing a structured object (with TypeScript definitions) representing the data from the environment.

Installation

npm install gitlab-ci-variables

Usage

import loadVariables, { isGitLabCI } from 'gitlab-ci-variables';

if (isGitLabCI()) {
  console.log('Running under GitLab CI runner');
}

const variables = loadVariables();
// variables === undefined iff !isGitLabCI()
if (variables) {
  console.log(`Build (ID ${variables.build.id}) of ${variables.project.name}. Started by ${variables.user.email}.`);
}

See the packaged TypeScript definitions for a full list of properties. Alternatively, see the Variables interface in the source code.

0.1.0

7 years ago