Package Exports
- env-ci
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (env-ci) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
env-ci
Get environment variables exposed by CI services.
Adapted from codecov-node.
Install
$ npm install --save env-ci
Usage
const {isCi, service, commit, build, branch, job, pr, isPr, slug, root} = require('env-ci');
Variables
Variable | Description |
---|---|
isCi |
true is running on a CI, false otherwise |
service |
CI service name |
commit |
Commit sha that triggered the CI build |
build |
CI service build number |
branch |
Git branch being built or targeted by a pull request |
job |
CI service job number |
pr |
Pull Request number |
isPr |
true is the build has been triggered by a Pull Request, false otherwise |
slug |
The slug (in form: owner_name/repo_name) of the repository currently being built. |
root |
The path to the directory where the repository is being built |
Supported CI
Service | isCi |
service |
commit |
build |
branch |
job |
pr |
isPr |
slug |
root |
---|---|---|---|---|---|---|---|---|---|---|
AppVeyor | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Buildkite | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
Circleci | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
Codeship | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ |
Drone | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
Gitlab CI | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ |
Jenkins | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ |
Semaphore | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Shippable | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Travis | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Wercker | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ |
If none of the above CI services is detected, commit
and branch
are determined based on the local Git repository, and isCi
is determined based on the CI
environment variable.