pax_global_header 0000666 0000000 0000000 00000000064 14517377127 0014530 g ustar 00root root 0000000 0000000 52 comment=3e1488e98680f1f776785fe8708a157b7f00e568
ci-info-4.0.0/ 0000775 0000000 0000000 00000000000 14517377127 0013055 5 ustar 00root root 0000000 0000000 ci-info-4.0.0/.github/ 0000775 0000000 0000000 00000000000 14517377127 0014415 5 ustar 00root root 0000000 0000000 ci-info-4.0.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000023 14517377127 0016225 0 ustar 00root root 0000000 0000000 github: [sibiraj-s] ci-info-4.0.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14517377127 0016600 5 ustar 00root root 0000000 0000000 ci-info-4.0.0/.github/ISSUE_TEMPLATE/ci-server-not-detected.md 0000664 0000000 0000000 00000001617 14517377127 0023403 0 ustar 00root root 0000000 0000000 ---
name: CI server not detected
about: Report an issue with detecting a specific CI server
---
**Details:**
- Ci name: [e.g. Travis CI]
- Website: [e.g. https://travis-ci.com/]
- Default env variables: [e.g. https://docs.travis-ci.com/user/environment-variables/#default-environment-variables]
**Environment variables**
Environment variables example
```
// Add a list of actual environment variables available to the build here
// Please keep the blank line above and below the code block
// WARNING: Be careful not to include any private or otherwise sensitive information
```
**Additional context**
Add any other context about the problem here.
ci-info-4.0.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14517377127 0016452 5 ustar 00root root 0000000 0000000 ci-info-4.0.0/.github/workflows/tests.yml 0000664 0000000 0000000 00000000627 14517377127 0020344 0 ustar 00root root 0000000 0000000 name: Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8, 10, 12, 14, 16, 18, 20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
ci-info-4.0.0/.gitignore 0000664 0000000 0000000 00000007117 14517377127 0015053 0 ustar 00root root 0000000 0000000 ### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Lock files
package-lock.json
pnpm-lock.yaml
yarn.lock
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
# SvelteKit build / generate output
.svelte-kit
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### yarn ###
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
# if you are NOT using Zero-installs, then:
# comment the following lines
!.yarn/cache
# and uncomment the following lines
# .pnp.*
ci-info-4.0.0/.husky/ 0000775 0000000 0000000 00000000000 14517377127 0014276 5 ustar 00root root 0000000 0000000 ci-info-4.0.0/.husky/pre-commit 0000775 0000000 0000000 00000000177 14517377127 0016305 0 ustar 00root root 0000000 0000000 #!/bin/sh
. "$(dirname "$0")/_/husky.sh"
node sort-vendors.js
node create-typings.js
git add index.d.ts
git add vendors.json
ci-info-4.0.0/CHANGELOG.md 0000664 0000000 0000000 00000013441 14517377127 0014671 0 ustar 00root root 0000000 0000000 # Changelog
## v4.0.0
- support Earthly CI [fb8bd85](https://github.com/watson/ci-info/commit/fb8bd85)
- support Prow CI [8e6a591](https://github.com/watson/ci-info/commit/8e6a591)
- support Vela CI [bb13901](https://github.com/watson/ci-info/commit/bb13901)
- support Agola CI [ec4e149](https://github.com/watson/ci-info/commit/ec4e149)
- support Gitea Actions [f6f173f](https://github.com/watson/ci-info/commit/f6f173f)
- run tests on nodejs v20 [bff314d](https://github.com/watson/ci-info/commit/bff314d)
#### Breaking Changes
- remove Shippable CI [2c5571a](https://github.com/watson/ci-info/commit/2c5571a)
- remove Solano CI [d6315fc](https://github.com/watson/ci-info/commit/d6315fc)
## v3.9.0
- better support for Azure Pipelines ([#116](https://github.com/watson/ci-info/pull/116)), [5ea8d85](https://github.com/watson/ci-info/commit/5ea8d85)
- detect PullRequest in Azure Pipelines [5ea8d85](https://github.com/watson/ci-info/commit/5ea8d85)
## v3.8.0
- support Harness CI [76a2867](https://github.com/watson/ci-info/commit/76a2867)
## v3.7.1
- ignore ci detection when CI is set to `'false'` [24cc450](https://github.com/watson/ci-info/commit/24cc450)
## v3.7.0
- support Sourcehut CI [85b96ea](https://github.com/watson/ci-info/commit/85b96ea)
- support ReleaseHub CI [409d886](https://github.com/watson/ci-info/commit/409d886)
## v3.6.2
- fix VERCEL environment detection ([#98](https://github.com/watson/ci-info/pull/98))
## v3.6.1
- fix error in typings [357b454](https://github.com/watson/ci-info/commit/357b454)
## v3.6.0
This release attempts to bring parity with [@npmcli/ci-detect](https://github.com/npm/ci-detect). See [#95](https://github.com/watson/ci-info/pull/95) for more details.
- support gerrit ([#95](https://github.com/watson/ci-info/pull/95))
- support google cloud build ([#95](https://github.com/watson/ci-info/pull/95))
- support heroku ([#95](https://github.com/watson/ci-info/pull/95))
- support anonymous CI's that exposes BUILD_ID and CI_NAME env vars ([#95](https://github.com/watson/ci-info/pull/95))
- support more vercel environments ([#95](https://github.com/watson/ci-info/pull/95))
## v3.5.0
- support Woodpecker CI ([#90](https://github.com/watson/ci-info/pull/90))
## v3.4.0
- partial support Appflow CI (only CI detection) ([#84](https://github.com/watson/ci-info/pull/84))
- support Codemagic CI ([#85](https://github.com/watson/ci-info/pull/85))
- support Xcode Server CI ([#86](https://github.com/watson/ci-info/pull/86))
- support Xcode Cloud CI ([#86](https://github.com/watson/ci-info/pull/86))
## v3.3.2
- fix: export correct typings for `EAS`
## v3.3.1
- fix: export `EAS_BUILD` constant in typings
- Add support for nodejs v18
## v3.3.0
- support Expo Application Services ([#70](https://github.com/watson/ci-info/pull/70))
## v3.2.0
- support LayerCI ([#68](https://github.com/watson/ci-info/pull/68))
- support Appcircle ([#69](https://github.com/watson/ci-info/pull/69))
- support Codefresh CI ([#65](https://github.com/watson/ci-info/pull/65))
- add support for nodejs v16
## v3.1.1
Bug Fixes:
- remove duplicate declaration in typings
## v3.1.0
Features:
- add typings
## v3.0.0
Features:
- Add support nodejs versions: 14, 15
- support Nevercode ([#30](https://github.com/watson/ci-info/pull/30))
- support Render CI ([#36](https://github.com/watson/ci-info/pull/36))
- support Now CI ([#37](https://github.com/watson/ci-info/pull/37))
- support GitLab PR ([#59](https://github.com/watson/ci-info/pull/59))
- support Screwdriver CD ([#60](https://github.com/watson/ci-info/pull/60))
- support Visual Studio App Center ([#61](https://github.com/watson/ci-info/pull/61))
Bug Fixes:
- update Netlify env constant ([#47](https://github.com/watson/ci-info/pull/47))
Breaking changes:
- Drop support for Node.js end-of-life versions: 6, 13
- replace `Zeit Now` with `Vercel` ([#55](https://github.com/watson/ci-info/pull/55))
## v2.0.0
Breaking changes:
- Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7, and 9
- Team Foundation Server will now be detected as Azure Pipelines. The constant `ci.TFS` no longer exists - use
`ci.AZURE_PIPELINES` instead
- Remove deprecated `ci.TDDIUM` constant - use `ci.SOLANDO` instead
New features:
- feat: support Azure Pipelines ([#23](https://github.com/watson/ci-info/pull/23))
- feat: support Netlify CI ([#26](https://github.com/watson/ci-info/pull/26))
- feat: support Bitbucket pipelines PR detection ([#27](https://github.com/watson/ci-info/pull/27))
## v1.6.0
- feat: add Sail CI support
- feat: add Buddy support
- feat: add Bitrise support
- feat: detect Jenkins PRs
- feat: detect Drone PRs
## v1.5.1
- fix: use full path to vendors.json
## v1.5.0
- feat: add dsari detection ([#15](https://github.com/watson/ci-info/pull/15))
- feat: add ci.isPR ([#16](https://github.com/watson/ci-info/pull/16))
## v1.4.0
- feat: add Cirrus CI detection ([#13](https://github.com/watson/ci-info/pull/13))
- feat: add Shippable CI detection ([#14](https://github.com/watson/ci-info/pull/14))
## v1.3.1
- chore: reduce npm package size by not including `.github` folder content
([#11](https://github.com/watson/ci-info/pull/11))
## v1.3.0
- feat: add support for Strider CD
- chore: deprecate vendor constant `TDDIUM` in favor of `SOLANO`
- docs: add missing vendor constant to docs
## v1.2.0
- feat: detect solano-ci ([#9](https://github.com/watson/ci-info/pull/9))
## v1.1.3
- fix: fix spelling of Hunson in `ci.name`
## v1.1.2
- fix: no more false positive matches for Jenkins
## v1.1.1
- docs: sort lists of CI servers in README.md
- docs: add missing AWS CodeBuild to the docs
## v1.1.0
- feat: add AWS CodeBuild to CI detection ([#2](https://github.com/watson/ci-info/pull/2))
## v1.0.1
- chore: reduce npm package size by using an `.npmignore` file ([#3](https://github.com/watson/ci-info/pull/3))
## v1.0.0
- Initial release
ci-info-4.0.0/LICENSE 0000664 0000000 0000000 00000002076 14517377127 0014067 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2016 Thomas Watson Steen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
ci-info-4.0.0/README.md 0000664 0000000 0000000 00000020044 14517377127 0014334 0 ustar 00root root 0000000 0000000 # ci-info
Get details about the current Continuous Integration environment.
Please [open an
issue](https://github.com/watson/ci-info/issues/new?template=ci-server-not-detected.md)
if your CI server isn't properly detected :)
[](https://www.npmjs.com/package/ci-info)
[](https://github.com/watson/ci-info/actions)
[](https://github.com/feross/standard)
## Installation
```bash
npm install ci-info --save
```
## Usage
```js
var ci = require('ci-info')
if (ci.isCI) {
console.log('The name of the CI server is:', ci.name)
} else {
console.log('This program is not running on a CI server')
}
```
## Supported CI tools
Officially supported CI servers:
| Name | Constant | isPR |
| ------------------------------------------------------------------------------- | ----------------------- | ---- |
| [Agola CI](https://agola.io/) | `ci.AGOLA` | ✅ |
| [Appcircle](https://appcircle.io/) | `ci.APPCIRCLE` | 🚫 |
| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ |
| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 |
| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ |
| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 |
| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ |
| [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ |
| [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ |
| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ |
| [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ |
| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ |
| [Codefresh](https://codefresh.io/) | `ci.CODEFRESH` | ✅ |
| [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 |
| [Drone](https://drone.io) | `ci.DRONE` | ✅ |
| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 |
| [Earthly CI](https://earthly.dev/) | `ci.EARTHLY` | 🚫 |
| [Expo Application Services](https://expo.dev/eas) | `ci.EAS` | 🚫 |
| [Gerrit CI](https://www.gerritcodereview.com) | `ci.GERRIT` | 🚫 |
| [GitHub Actions](https://github.com/features/actions/) | `ci.GITHUB_ACTIONS` | ✅ |
| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | ✅ |
| [Gitea Actions](https://about.gitea.com/) | `ci.GITEA_ACTIONS` | 🚫 |
| [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 |
| [Google Cloud Build](https://cloud.google.com/build) | `ci.GOOGLE_CLOUD_BUILD` | 🚫 |
| [Harness CI](https://www.harness.io/products/continuous-integration) | `ci.HARNESS` | 🚫 |
| [Heroku](https://www.heroku.com) | `ci.HEROKU` | 🚫 |
| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 |
| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ |
| [LayerCI](https://layerci.com/) | `ci.LAYERCI` | ✅ |
| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 |
| [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ |
| [Nevercode](http://nevercode.io/) | `ci.NEVERCODE` | ✅ |
| [Prow](https://docs.prow.k8s.io/) | `ci.PROW` | 🚫 |
| [ReleaseHub](https://releasehub.com/) | `ci.RELEASEHUB` | 🚫 |
| [Render](https://render.com/) | `ci.RENDER` | ✅ |
| [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ |
| [Screwdriver](https://screwdriver.cd/) | `ci.SCREWDRIVER` | ✅ |
| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ |
| [Sourcehut](https://sourcehut.org/) | `ci.SOURCEHUT` | 🚫 |
| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 |
| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 |
| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 |
| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ |
| [Vela](https://go-vela.github.io/docs/) | `ci.VELA` | ✅ |
| [Vercel](https://vercel.com/) | `ci.VERCEL` | ✅ |
| [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 |
| [Woodpecker](https://woodpecker-ci.org/) | `ci.WOODPECKER` | ✅ |
## API
### `ci.name`
Returns a string containing name of the CI server the code is running on.
If CI server is not detected, it returns `null`.
Don't depend on the value of this string not to change for a specific
vendor. If you find your self writing `ci.name === 'Travis CI'`, you
most likely want to use `ci.TRAVIS` instead.
### `ci.isCI`
Returns a boolean. Will be `true` if the code is running on a CI server,
otherwise `false`.
Some CI servers not listed here might still trigger the `ci.isCI`
boolean to be set to `true` if they use certain vendor neutral
environment variables. In those cases `ci.name` will be `null` and no
vendor specific boolean will be set to `true`.
### `ci.isPR`
Returns a boolean if PR detection is supported for the current CI server. Will
be `true` if a PR is being tested, otherwise `false`. If PR detection is
not supported for the current CI server, the value will be `null`.
### `ci.`
A vendor specific boolean constant is exposed for each support CI
vendor. A constant will be `true` if the code is determined to run on
the given CI server, otherwise `false`.
Examples of vendor constants are `ci.TRAVIS` or `ci.APPVEYOR`. For a
complete list, see the support table above.
## Ports
ci-info has been ported to the following languages
| Language | Repository |
|----------|------------|
| Go | https://github.com/hofstadter-io/cinful |
| Rust | https://github.com/sagiegurari/ci_info |
| Kotlin | https://github.com/cloudflightio/ci-info |
## License
[MIT](LICENSE)
ci-info-4.0.0/create-typings.js 0000664 0000000 0000000 00000002661 14517377127 0016356 0 ustar 00root root 0000000 0000000 'use strict'
const fs = require('fs')
const vendors = require('./vendors.json')
function createTypings () {
let typings = `// This file is generated at pre-commit by running \`node create-typings.js\`.
/**
* Returns a boolean. Will be \`true\` if the code is running on a CI server,
* otherwise \`false\`.
*
* Some CI servers not listed here might still trigger the \`ci.isCI\`
* boolean to be set to \`true\` if they use certain vendor neutral environment
* variables. In those cases \`ci.name\` will be \`null\` and no vendor specific
* boolean will be set to \`true\`.
*/
export const isCI: boolean;
/**
* Returns a boolean if PR detection is supported for the current CI server.
* Will be \`true\` if a PR is being tested, otherwise \`false\`. If PR detection is
* not supported for the current CI server, the value will be \`null\`.
*/
export const isPR: boolean | null;
/**
* Returns a string containing name of the CI server the code is running on. If
* CI server is not detected, it returns \`null\`.
*
* Don't depend on the value of this string not to change for a specific vendor.
* If you find your self writing \`ci.name === 'Travis CI'\`, you most likely want
* to use \`ci.TRAVIS\` instead.
*/
export const name: string | null;
`
for (const { constant } of vendors) {
typings += `export const ${constant}: boolean;`
typings += '\n'
}
return typings
}
fs.writeFileSync('./index.d.ts', createTypings())
ci-info-4.0.0/index.d.ts 0000664 0000000 0000000 00000005221 14517377127 0014756 0 ustar 00root root 0000000 0000000 // This file is generated at pre-commit by running `node create-typings.js`.
/**
* Returns a boolean. Will be `true` if the code is running on a CI server,
* otherwise `false`.
*
* Some CI servers not listed here might still trigger the `ci.isCI`
* boolean to be set to `true` if they use certain vendor neutral environment
* variables. In those cases `ci.name` will be `null` and no vendor specific
* boolean will be set to `true`.
*/
export const isCI: boolean;
/**
* Returns a boolean if PR detection is supported for the current CI server.
* Will be `true` if a PR is being tested, otherwise `false`. If PR detection is
* not supported for the current CI server, the value will be `null`.
*/
export const isPR: boolean | null;
/**
* Returns a string containing name of the CI server the code is running on. If
* CI server is not detected, it returns `null`.
*
* Don't depend on the value of this string not to change for a specific vendor.
* If you find your self writing `ci.name === 'Travis CI'`, you most likely want
* to use `ci.TRAVIS` instead.
*/
export const name: string | null;
export const AGOLA: boolean;
export const APPCIRCLE: boolean;
export const APPVEYOR: boolean;
export const CODEBUILD: boolean;
export const AZURE_PIPELINES: boolean;
export const BAMBOO: boolean;
export const BITBUCKET: boolean;
export const BITRISE: boolean;
export const BUDDY: boolean;
export const BUILDKITE: boolean;
export const CIRCLE: boolean;
export const CIRRUS: boolean;
export const CODEFRESH: boolean;
export const CODEMAGIC: boolean;
export const CODESHIP: boolean;
export const DRONE: boolean;
export const DSARI: boolean;
export const EARTHLY: boolean;
export const EAS: boolean;
export const GERRIT: boolean;
export const GITEA_ACTIONS: boolean;
export const GITHUB_ACTIONS: boolean;
export const GITLAB: boolean;
export const GOCD: boolean;
export const GOOGLE_CLOUD_BUILD: boolean;
export const HARNESS: boolean;
export const HEROKU: boolean;
export const HUDSON: boolean;
export const JENKINS: boolean;
export const LAYERCI: boolean;
export const MAGNUM: boolean;
export const NETLIFY: boolean;
export const NEVERCODE: boolean;
export const PROW: boolean;
export const RELEASEHUB: boolean;
export const RENDER: boolean;
export const SAIL: boolean;
export const SCREWDRIVER: boolean;
export const SEMAPHORE: boolean;
export const SOURCEHUT: boolean;
export const STRIDER: boolean;
export const TASKCLUSTER: boolean;
export const TEAMCITY: boolean;
export const TRAVIS: boolean;
export const VELA: boolean;
export const VERCEL: boolean;
export const APPCENTER: boolean;
export const WOODPECKER: boolean;
export const XCODE_CLOUD: boolean;
export const XCODE_SERVER: boolean;
ci-info-4.0.0/index.js 0000664 0000000 0000000 00000004500 14517377127 0014521 0 ustar 00root root 0000000 0000000 'use strict'
const vendors = require('./vendors.json')
const env = process.env
// Used for testing only
Object.defineProperty(exports, '_vendors', {
value: vendors.map(function (v) {
return v.constant
})
})
exports.name = null
exports.isPR = null
vendors.forEach(function (vendor) {
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]
const isCI = envs.every(function (obj) {
return checkEnv(obj)
})
exports[vendor.constant] = isCI
if (!isCI) {
return
}
exports.name = vendor.name
switch (typeof vendor.pr) {
case 'string':
// "pr": "CIRRUS_PR"
exports.isPR = !!env[vendor.pr]
break
case 'object':
if ('env' in vendor.pr) {
// "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne
} else if ('any' in vendor.pr) {
// "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
exports.isPR = vendor.pr.any.some(function (key) {
return !!env[key]
})
} else {
// "pr": { "DRONE_BUILD_EVENT": "pull_request" }
exports.isPR = checkEnv(vendor.pr)
}
break
default:
// PR detection not supported for this vendor
exports.isPR = null
}
})
exports.isCI = !!(
env.CI !== 'false' && // Bypass all checks if CI env is explicitly set to 'false'
(env.BUILD_ID || // Jenkins, Cloudbees
env.BUILD_NUMBER || // Jenkins, TeamCity
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
env.CI_APP_ID || // Appflow
env.CI_BUILD_ID || // Appflow
env.CI_BUILD_NUMBER || // Appflow
env.CI_NAME || // Codeship and others
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
env.RUN_ID || // TaskCluster, dsari
exports.name ||
false)
)
function checkEnv (obj) {
// "env": "CIRRUS"
if (typeof obj === 'string') return !!env[obj]
// "env": { "env": "NODE", "includes": "/app/.heroku/node/bin/node" }
if ('env' in obj) {
// Currently there are no other types, uncomment when there are
// if ('includes' in obj) {
return env[obj.env] && env[obj.env].includes(obj.includes)
// }
}
if ('any' in obj) {
return obj.any.some(function (k) {
return !!env[k]
})
}
return Object.keys(obj).every(function (k) {
return env[k] === obj[k]
})
}
ci-info-4.0.0/package.json 0000664 0000000 0000000 00000001777 14517377127 0015357 0 ustar 00root root 0000000 0000000 {
"name": "ci-info",
"version": "4.0.0",
"description": "Get details about the current Continuous Integration environment",
"main": "index.js",
"typings": "index.d.ts",
"author": "Thomas Watson Steen (https://twitter.com/wa7son)",
"license": "MIT",
"repository": "https://github.com/watson/ci-info.git",
"bugs": "https://github.com/watson/ci-info/issues",
"homepage": "https://github.com/watson/ci-info",
"keywords": [
"ci",
"continuous",
"integration",
"test",
"detect"
],
"files": [
"vendors.json",
"index.js",
"index.d.ts",
"CHANGELOG.md"
],
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/sibiraj-s"
}
],
"scripts": {
"lint:fix": "standard --fix",
"test": "standard && node test.js",
"prepare": "husky install"
},
"devDependencies": {
"clear-module": "^4.1.2",
"husky": "^8.0.3",
"standard": "^17.1.0",
"tape": "^5.7.0"
},
"engines": {
"node": ">=8"
}
}
ci-info-4.0.0/sort-vendors.js 0000664 0000000 0000000 00000001125 14517377127 0016057 0 ustar 00root root 0000000 0000000 const fs = require('fs/promises')
const path = require('path')
const vendorsJson = require('./vendors.json')
// Sort the vendors by name
const sortedVendors = vendorsJson.map(item => item).sort((a, b) => a.name.localeCompare(b.name))
// Get the full path to the vendors file
const vendorsFilePath = path.join(__dirname, 'vendors.json')
const sort = async () => {
try {
const vendorsString = JSON.stringify(sortedVendors, null, 2) + '\n'
await fs.writeFile(vendorsFilePath, vendorsString, 'utf-8')
} catch (error) {
console.error(`Error writing to file: ${error}`)
}
}
sort()
ci-info-4.0.0/test.js 0000664 0000000 0000000 00000050575 14517377127 0014406 0 ustar 00root root 0000000 0000000 'use strict'
const test = require('tape')
const clearModule = require('clear-module')
const isActualPR = !!(process.env.GITHUB_EVENT_NAME && process.env.GITHUB_EVENT_NAME === 'pull_request')
test('Known CI', function (t) {
process.env.GITHUB_ACTIONS = 'true'
const ci = require('./')
t.ok(Array.isArray(ci._vendors))
t.ok(ci._vendors.length > 0)
t.equal(ci.isCI, true)
t.equal(ci.isPR, isActualPR)
t.equal(ci.name, 'GitHub Actions')
t.equal(ci.GITHUB_ACTIONS, true)
assertVendorConstants('GITHUB_ACTIONS', ci, t)
t.end()
})
test('Not CI', function (t) {
delete process.env.CI
delete process.env.CONTINUOUS_INTEGRATION
delete process.env.BUILD_NUMBER
delete process.env.TRAVIS
delete process.env.GITHUB_ACTIONS
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, false)
t.equal(ci.isPR, null)
t.equal(ci.name, null)
t.equal(ci.TRAVIS, false)
assertVendorConstants(null, ci, t)
t.end()
})
test('Bypass isCI checks with CI set to `false`', function (t) {
process.env.CI = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, false)
t.end()
})
test('Unknown CI', function (t) {
process.env.CI = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, null)
t.equal(ci.name, null)
t.equal(ci.TRAVIS, false)
assertVendorConstants(null, ci, t)
t.end()
})
test('Anonymous CI', function (t) {
const ANONYMOUS_ENV_VARS = [
'CI', 'CONTINUOUS_INTEGRATION', 'BUILD_ID',
'BUILD_NUMBER', 'CI_APP_ID', 'CI_BUILD_ID',
'CI_BUILD_NUMBER', 'RUN_ID', 'CI_NAME'
]
for (const envVar in ANONYMOUS_ENV_VARS) {
process.env[envVar] = true
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, null)
t.equal(ci.name, null)
}
t.end()
})
test('AppVeyor - PR', function (t) {
process.env.APPVEYOR = 'true'
process.env.APPVEYOR_PULL_REQUEST_NUMBER = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'AppVeyor')
t.equal(ci.APPVEYOR, true)
assertVendorConstants('APPVEYOR', ci, t)
delete process.env.APPVEYOR
delete process.env.APPVEYOR_PULL_REQUEST_NUMBER
t.end()
})
test('AppVeyor - Not PR', function (t) {
process.env.APPVEYOR = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'AppVeyor')
t.equal(ci.APPVEYOR, true)
assertVendorConstants('APPVEYOR', ci, t)
delete process.env.APPVEYOR
t.end()
})
test('Azure Pipelines - PR', function (t) {
process.env.TF_BUILD = 'true'
process.env.BUILD_REASON = 'PullRequest'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Azure Pipelines')
t.equal(ci.AZURE_PIPELINES, true)
assertVendorConstants('AZURE_PIPELINES', ci, t)
delete process.env.TF_BUILD
delete process.env.BUILD_REASON
t.end()
})
test('Azure Pipelines - Not PR', function (t) {
process.env.TF_BUILD = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Azure Pipelines')
t.equal(ci.AZURE_PIPELINES, true)
assertVendorConstants('AZURE_PIPELINES', ci, t)
delete process.env.TF_BUILD
t.end()
})
test('Bitbucket Pipelines - PR', function (t) {
process.env.BITBUCKET_COMMIT = 'true'
process.env.BITBUCKET_PR_ID = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Bitbucket Pipelines')
t.equal(ci.BITBUCKET, true)
assertVendorConstants('BITBUCKET', ci, t)
delete process.env.BITBUCKET_COMMIT
delete process.env.BITBUCKET_PR_ID
t.end()
})
test('Bitbucket Pipelines - Not PR', function (t) {
process.env.BITBUCKET_COMMIT = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Bitbucket Pipelines')
t.equal(ci.BITBUCKET, true)
assertVendorConstants('BITBUCKET', ci, t)
delete process.env.BITBUCKET_COMMIT
t.end()
})
test('Buildkite - PR', function (t) {
process.env.BUILDKITE = 'true'
process.env.BUILDKITE_PULL_REQUEST = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Buildkite')
t.equal(ci.BUILDKITE, true)
assertVendorConstants('BUILDKITE', ci, t)
delete process.env.BUILDKITE
delete process.env.BUILDKITE_PULL_REQUEST
t.end()
})
test('Buildkite - Not PR', function (t) {
process.env.BUILDKITE = 'true'
process.env.BUILDKITE_PULL_REQUEST = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Buildkite')
t.equal(ci.BUILDKITE, true)
assertVendorConstants('BUILDKITE', ci, t)
delete process.env.BUILDKITE
delete process.env.BUILDKITE_PULL_REQUEST
t.end()
})
test('CircleCI - PR', function (t) {
process.env.CIRCLECI = 'true'
process.env.CIRCLE_PULL_REQUEST = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'CircleCI')
t.equal(ci.CIRCLE, true)
assertVendorConstants('CIRCLE', ci, t)
delete process.env.CIRCLECI
delete process.env.CIRCLE_PULL_REQUEST
t.end()
})
test('CircleCI - Not PR', function (t) {
process.env.CIRCLECI = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'CircleCI')
t.equal(ci.CIRCLE, true)
assertVendorConstants('CIRCLE', ci, t)
delete process.env.CIRCLECI
t.end()
})
test('Cirrus CI - PR', function (t) {
process.env.CIRRUS_CI = 'true'
process.env.CIRRUS_PR = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Cirrus CI')
t.equal(ci.CIRRUS, true)
assertVendorConstants('CIRRUS', ci, t)
delete process.env.CIRRUS_CI
delete process.env.CIRRUS_PR
t.end()
})
test('Cirrus CI - Not PR', function (t) {
process.env.CIRRUS_CI = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Cirrus CI')
t.equal(ci.CIRRUS, true)
assertVendorConstants('CIRRUS', ci, t)
delete process.env.CIRRUS_CI
t.end()
})
test('Codefresh - PR', function (t) {
process.env.CF_BUILD_ID = 'true'
process.env.CF_PULL_REQUEST_ID = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Codefresh')
t.equal(ci.CODEFRESH, true)
assertVendorConstants('CODEFRESH', ci, t)
delete process.env.CF_BUILD_ID
delete process.env.CF_PULL_REQUEST_ID
t.end()
})
test('Codefresh - Not PR', function (t) {
process.env.CF_BUILD_ID = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Codefresh')
t.equal(ci.CODEFRESH, true)
assertVendorConstants('CODEFRESH', ci, t)
delete process.env.CF_BUILD_ID
t.end()
})
test('LayerCI - PR', function (t) {
process.env.LAYERCI = 'true'
process.env.LAYERCI_PULL_REQUEST = 'https://link-to-pr/5'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'LayerCI')
t.equal(ci.LAYERCI, true)
assertVendorConstants('LAYERCI', ci, t)
delete process.env.LAYERCI
delete process.env.LAYERCI_PULL_REQUEST
t.end()
})
test('LayerCI - Not PR', function (t) {
process.env.LAYERCI = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'LayerCI')
t.equal(ci.LAYERCI, true)
assertVendorConstants('LAYERCI', ci, t)
delete process.env.LAYERCI
t.end()
})
test('Appcircle', function (t) {
process.env.AC_APPCIRCLE = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'Appcircle')
t.equal(ci.APPCIRCLE, true)
assertVendorConstants('APPCIRCLE', ci, t)
delete process.env.AC_APPCIRCLE
t.end()
})
test('Render - PR', function (t) {
process.env.RENDER = 'true'
process.env.IS_PULL_REQUEST = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Render')
t.equal(ci.RENDER, true)
assertVendorConstants('RENDER', ci, t)
delete process.env.RENDER
delete process.env.IS_PULL_REQUEST
t.end()
})
test('Render - Not PR', function (t) {
process.env.RENDER = 'true'
process.env.IS_PULL_REQUEST = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Render')
t.equal(ci.RENDER, true)
assertVendorConstants('RENDER', ci, t)
delete process.env.RENDER
delete process.env.IS_PULL_REQUEST
t.end()
})
test('Semaphore - PR', function (t) {
process.env.SEMAPHORE = 'true'
process.env.PULL_REQUEST_NUMBER = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Semaphore')
t.equal(ci.SEMAPHORE, true)
assertVendorConstants('SEMAPHORE', ci, t)
delete process.env.SEMAPHORE
delete process.env.PULL_REQUEST_NUMBER
t.end()
})
test('Semaphore - Not PR', function (t) {
process.env.SEMAPHORE = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Semaphore')
t.equal(ci.SEMAPHORE, true)
assertVendorConstants('SEMAPHORE', ci, t)
delete process.env.SEMAPHORE
t.end()
})
test('Travis CI - PR', function (t) {
process.env.TRAVIS = 'true'
process.env.TRAVIS_PULL_REQUEST = '42'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Travis CI')
t.equal(ci.TRAVIS, true)
assertVendorConstants('TRAVIS', ci, t)
delete process.env.TRAVIS
delete process.env.TRAVIS_PULL_REQUEST
t.end()
})
test('Travis CI - Not PR', function (t) {
process.env.TRAVIS = 'true'
process.env.TRAVIS_PULL_REQUEST = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Travis CI')
t.equal(ci.TRAVIS, true)
assertVendorConstants('TRAVIS', ci, t)
delete process.env.TRAVIS
delete process.env.TRAVIS_PULL_REQUEST
t.end()
})
test('Netlify CI - PR', function (t) {
process.env.NETLIFY = 'true'
process.env.PULL_REQUEST = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Netlify CI')
t.equal(ci.NETLIFY, true)
assertVendorConstants('NETLIFY', ci, t)
delete process.env.NETLIFY
delete process.env.PULL_REQUEST
t.end()
})
test('Netlify CI - Not PR', function (t) {
process.env.NETLIFY = 'true'
process.env.PULL_REQUEST = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Netlify CI')
t.equal(ci.NETLIFY, true)
assertVendorConstants('NETLIFY', ci, t)
delete process.env.NETLIFY
delete process.env.PULL_REQUEST
t.end()
})
test('Vercel - NOW_BUILDER', function (t) {
process.env.NOW_BUILDER = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Vercel')
t.equal(ci.VERCEL, true)
assertVendorConstants('VERCEL', ci, t)
delete process.env.NOW_BUILDER
t.end()
})
test('Vercel - VERCEL', function (t) {
process.env.VERCEL = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Vercel')
t.equal(ci.VERCEL, true)
assertVendorConstants('VERCEL', ci, t)
delete process.env.VERCEL
t.end()
})
test('Vercel - PR', function (t) {
process.env.VERCEL = '1'
process.env.VERCEL_GIT_PULL_REQUEST_ID = '23'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Vercel')
t.equal(ci.VERCEL, true)
assertVendorConstants('VERCEL', ci, t)
delete process.env.VERCEL
t.end()
})
test('Nevercode - PR', function (t) {
process.env.NEVERCODE = 'true'
process.env.NEVERCODE_PULL_REQUEST = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Nevercode')
t.equal(ci.NEVERCODE, true)
assertVendorConstants('NEVERCODE', ci, t)
delete process.env.NEVERCODE
delete process.env.NEVERCODE_PULL_REQUEST
t.end()
})
test('Nevercode - Not PR', function (t) {
process.env.NEVERCODE = 'true'
process.env.NEVERCODE_PULL_REQUEST = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Nevercode')
t.equal(ci.NEVERCODE, true)
assertVendorConstants('NEVERCODE', ci, t)
delete process.env.NEVERCODE
delete process.env.NEVERCODE_PULL_REQUEST
t.end()
})
test('Expo Application Services', function (t) {
process.env.EAS_BUILD = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, null)
t.equal(ci.name, 'Expo Application Services')
t.equal(ci.EAS, true)
assertVendorConstants('EAS', ci, t)
delete process.env.EAS_BUILD
t.end()
})
test('GitHub Actions - PR', function (t) {
process.env.GITHUB_ACTIONS = 'true'
process.env.GITHUB_EVENT_NAME = 'pull_request'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'GitHub Actions')
t.equal(ci.GITHUB_ACTIONS, true)
assertVendorConstants('GITHUB_ACTIONS', ci, t)
delete process.env.GITHUB_ACTIONS
delete process.env.GITHUB_EVENT_NAME
t.end()
})
test('GitHub Actions - Not PR', function (t) {
process.env.GITHUB_ACTIONS = 'true'
process.env.GITHUB_EVENT_NAME = 'push'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'GitHub Actions')
t.equal(ci.GITHUB_ACTIONS, true)
assertVendorConstants('GITHUB_ACTIONS', ci, t)
delete process.env.GITHUB_ACTIONS
delete process.env.GITHUB_EVENT_NAME
t.end()
})
test('Screwdriver - PR', function (t) {
process.env.SCREWDRIVER = 'true'
process.env.SD_PULL_REQUEST = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Screwdriver')
t.equal(ci.SCREWDRIVER, true)
assertVendorConstants('SCREWDRIVER', ci, t)
delete process.env.SCREWDRIVER
delete process.env.SD_PULL_REQUEST
t.end()
})
test('Screwdriver - Not PR', function (t) {
process.env.SCREWDRIVER = 'true'
process.env.SD_PULL_REQUEST = 'false'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Screwdriver')
t.equal(ci.SCREWDRIVER, true)
assertVendorConstants('SCREWDRIVER', ci, t)
delete process.env.SCREWDRIVER
delete process.env.SD_PULL_REQUEST
t.end()
})
test('Visual Studio App Center', function (t) {
process.env.APPCENTER_BUILD_ID = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
// t.equal(ci.isPR, false)
t.equal(ci.name, 'Visual Studio App Center')
t.equal(ci.APPCENTER, true)
assertVendorConstants('APPCENTER', ci, t)
delete process.env.APPCENTER_BUILD_ID
t.end()
})
test('Codemagic - PR', function (t) {
process.env.CM_BUILD_ID = '1'
process.env.CM_PULL_REQUEST = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Codemagic')
t.equal(ci.CODEMAGIC, true)
assertVendorConstants('CODEMAGIC', ci, t)
delete process.env.CM_BUILD_ID
delete process.env.CM_PULL_REQUEST
t.end()
})
test('Codemagic - Not PR', function (t) {
process.env.CM_BUILD_ID = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Codemagic')
t.equal(ci.CODEMAGIC, true)
assertVendorConstants('CODEMAGIC', ci, t)
delete process.env.CM_BUILD_ID
t.end()
})
test('Xcode Cloud - PR', function (t) {
process.env.CI_XCODE_PROJECT = 'xx'
process.env.CI_PULL_REQUEST_NUMBER = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Xcode Cloud')
t.equal(ci.XCODE_CLOUD, true)
assertVendorConstants('XCODE_CLOUD', ci, t)
delete process.env.CI_XCODE_PROJECT
delete process.env.CI_PULL_REQUEST_NUMBER
t.end()
})
test('Xcode Cloud - Not PR', function (t) {
process.env.CI_XCODE_PROJECT = 'xx'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Xcode Cloud')
t.equal(ci.XCODE_CLOUD, true)
assertVendorConstants('XCODE_CLOUD', ci, t)
delete process.env.CI_XCODE_PROJECT
t.end()
})
test('Xcode Server - Not PR', function (t) {
process.env.XCS = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
// t.equal(ci.isPR, false)
t.equal(ci.name, 'Xcode Server')
t.equal(ci.XCODE_SERVER, true)
assertVendorConstants('XCODE_SERVER', ci, t)
delete process.env.XCS
t.end()
})
test('Heroku', function (t) {
const realNode = process.env.NODE
process.env.NODE = '/extra/content/app/.heroku/node/bin/node --extra --content'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'Heroku')
t.equal(ci.HEROKU, true)
assertVendorConstants('HEROKU', ci, t)
process.env.NODE = realNode
t.end()
})
test('Sourcehit', function (t) {
process.env.CI_NAME = 'sourcehut'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'Sourcehut')
t.equal(ci.SOURCEHUT, true)
assertVendorConstants('SOURCEHUT', ci, t)
delete process.env.CI_NAME
t.end()
})
test('ReleaseHub', function (t) {
process.env.RELEASE_BUILD_ID = '1a'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'ReleaseHub')
t.equal(ci.RELEASEHUB, true)
assertVendorConstants('RELEASEHUB', ci, t)
delete process.env.RELEASE_BUILD_ID
t.end()
})
test('Gitea Actions', function (t) {
process.env.GITEA_ACTIONS = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'Gitea Actions')
t.equal(ci.GITEA_ACTIONS, true)
assertVendorConstants('GITEA_ACTIONS', ci, t)
delete process.env.GITEA_ACTIONS
t.end()
})
test('Agola CI', function (t) {
process.env.AGOLA_GIT_REF = 'true'
process.env.AGOLA_PULL_REQUEST_ID = ''
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Agola CI')
t.equal(ci.AGOLA, true)
assertVendorConstants('AGOLA', ci, t)
delete process.env.AGOLA_GIT_REF
delete process.env.AGOLA_PULL_REQUEST_ID
t.end()
})
test('Agola CI - PR', function (t) {
process.env.AGOLA_GIT_REF = 'true'
process.env.AGOLA_PULL_REQUEST_ID = '12'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Agola CI')
t.equal(ci.AGOLA, true)
assertVendorConstants('AGOLA', ci, t)
delete process.env.AGOLA_GIT_REF
delete process.env.AGOLA_PULL_REQUEST_ID
t.end()
})
test('Vela', function (t) {
process.env.VELA = 'true'
process.env.VELA_PULL_REQUEST = '2'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Vela')
t.equal(ci.VELA, true)
assertVendorConstants('VELA', ci, t)
delete process.env.VELA
delete process.env.VELA_PULL_REQUEST
t.end()
})
test('Vela - PR', function (t) {
process.env.VELA = 'true'
process.env.VELA_PULL_REQUEST = '1'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Vela')
t.equal(ci.VELA, true)
assertVendorConstants('VELA', ci, t)
delete process.env.VELA
delete process.env.VELA_PULL_REQUEST
t.end()
})
test('Prow', function (t) {
process.env.PROW_JOB_ID = '123'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'Prow')
t.equal(ci.PROW, true)
assertVendorConstants('PROW', ci, t)
delete process.env.PROW_JOB_ID
t.end()
})
test('Earthly CI', function (t) {
process.env.EARTHLY_CI = 'true'
clearModule('./')
const ci = require('./')
t.equal(ci.isCI, true)
t.equal(ci.name, 'Earthly')
t.equal(ci.EARTHLY, true)
assertVendorConstants('EARTHLY', ci, t)
delete process.env.EARTHLY_CI
t.end()
})
function assertVendorConstants (expect, ci, t) {
ci._vendors.forEach(function (constant) {
const bool = constant === expect
t.equal(ci[constant], bool, 'ci.' + constant)
})
}
ci-info-4.0.0/vendors.json 0000664 0000000 0000000 00000013531 14517377127 0015433 0 ustar 00root root 0000000 0000000 [
{
"name": "Agola CI",
"constant": "AGOLA",
"env": "AGOLA_GIT_REF",
"pr": "AGOLA_PULL_REQUEST_ID"
},
{
"name": "Appcircle",
"constant": "APPCIRCLE",
"env": "AC_APPCIRCLE"
},
{
"name": "AppVeyor",
"constant": "APPVEYOR",
"env": "APPVEYOR",
"pr": "APPVEYOR_PULL_REQUEST_NUMBER"
},
{
"name": "AWS CodeBuild",
"constant": "CODEBUILD",
"env": "CODEBUILD_BUILD_ARN"
},
{
"name": "Azure Pipelines",
"constant": "AZURE_PIPELINES",
"env": "TF_BUILD",
"pr": {
"BUILD_REASON": "PullRequest"
}
},
{
"name": "Bamboo",
"constant": "BAMBOO",
"env": "bamboo_planKey"
},
{
"name": "Bitbucket Pipelines",
"constant": "BITBUCKET",
"env": "BITBUCKET_COMMIT",
"pr": "BITBUCKET_PR_ID"
},
{
"name": "Bitrise",
"constant": "BITRISE",
"env": "BITRISE_IO",
"pr": "BITRISE_PULL_REQUEST"
},
{
"name": "Buddy",
"constant": "BUDDY",
"env": "BUDDY_WORKSPACE_ID",
"pr": "BUDDY_EXECUTION_PULL_REQUEST_ID"
},
{
"name": "Buildkite",
"constant": "BUILDKITE",
"env": "BUILDKITE",
"pr": {
"env": "BUILDKITE_PULL_REQUEST",
"ne": "false"
}
},
{
"name": "CircleCI",
"constant": "CIRCLE",
"env": "CIRCLECI",
"pr": "CIRCLE_PULL_REQUEST"
},
{
"name": "Cirrus CI",
"constant": "CIRRUS",
"env": "CIRRUS_CI",
"pr": "CIRRUS_PR"
},
{
"name": "Codefresh",
"constant": "CODEFRESH",
"env": "CF_BUILD_ID",
"pr": {
"any": [
"CF_PULL_REQUEST_NUMBER",
"CF_PULL_REQUEST_ID"
]
}
},
{
"name": "Codemagic",
"constant": "CODEMAGIC",
"env": "CM_BUILD_ID",
"pr": "CM_PULL_REQUEST"
},
{
"name": "Codeship",
"constant": "CODESHIP",
"env": {
"CI_NAME": "codeship"
}
},
{
"name": "Drone",
"constant": "DRONE",
"env": "DRONE",
"pr": {
"DRONE_BUILD_EVENT": "pull_request"
}
},
{
"name": "dsari",
"constant": "DSARI",
"env": "DSARI"
},
{
"name": "Earthly",
"constant": "EARTHLY",
"env": "EARTHLY_CI"
},
{
"name": "Expo Application Services",
"constant": "EAS",
"env": "EAS_BUILD"
},
{
"name": "Gerrit",
"constant": "GERRIT",
"env": "GERRIT_PROJECT"
},
{
"name": "Gitea Actions",
"constant": "GITEA_ACTIONS",
"env": "GITEA_ACTIONS"
},
{
"name": "GitHub Actions",
"constant": "GITHUB_ACTIONS",
"env": "GITHUB_ACTIONS",
"pr": {
"GITHUB_EVENT_NAME": "pull_request"
}
},
{
"name": "GitLab CI",
"constant": "GITLAB",
"env": "GITLAB_CI",
"pr": "CI_MERGE_REQUEST_ID"
},
{
"name": "GoCD",
"constant": "GOCD",
"env": "GO_PIPELINE_LABEL"
},
{
"name": "Google Cloud Build",
"constant": "GOOGLE_CLOUD_BUILD",
"env": "BUILDER_OUTPUT"
},
{
"name": "Harness CI",
"constant": "HARNESS",
"env": "HARNESS_BUILD_ID"
},
{
"name": "Heroku",
"constant": "HEROKU",
"env": {
"env": "NODE",
"includes": "/app/.heroku/node/bin/node"
}
},
{
"name": "Hudson",
"constant": "HUDSON",
"env": "HUDSON_URL"
},
{
"name": "Jenkins",
"constant": "JENKINS",
"env": [
"JENKINS_URL",
"BUILD_ID"
],
"pr": {
"any": [
"ghprbPullId",
"CHANGE_ID"
]
}
},
{
"name": "LayerCI",
"constant": "LAYERCI",
"env": "LAYERCI",
"pr": "LAYERCI_PULL_REQUEST"
},
{
"name": "Magnum CI",
"constant": "MAGNUM",
"env": "MAGNUM"
},
{
"name": "Netlify CI",
"constant": "NETLIFY",
"env": "NETLIFY",
"pr": {
"env": "PULL_REQUEST",
"ne": "false"
}
},
{
"name": "Nevercode",
"constant": "NEVERCODE",
"env": "NEVERCODE",
"pr": {
"env": "NEVERCODE_PULL_REQUEST",
"ne": "false"
}
},
{
"name": "Prow",
"constant": "PROW",
"env": "PROW_JOB_ID"
},
{
"name": "ReleaseHub",
"constant": "RELEASEHUB",
"env": "RELEASE_BUILD_ID"
},
{
"name": "Render",
"constant": "RENDER",
"env": "RENDER",
"pr": {
"IS_PULL_REQUEST": "true"
}
},
{
"name": "Sail CI",
"constant": "SAIL",
"env": "SAILCI",
"pr": "SAIL_PULL_REQUEST_NUMBER"
},
{
"name": "Screwdriver",
"constant": "SCREWDRIVER",
"env": "SCREWDRIVER",
"pr": {
"env": "SD_PULL_REQUEST",
"ne": "false"
}
},
{
"name": "Semaphore",
"constant": "SEMAPHORE",
"env": "SEMAPHORE",
"pr": "PULL_REQUEST_NUMBER"
},
{
"name": "Sourcehut",
"constant": "SOURCEHUT",
"env": {
"CI_NAME": "sourcehut"
}
},
{
"name": "Strider CD",
"constant": "STRIDER",
"env": "STRIDER"
},
{
"name": "TaskCluster",
"constant": "TASKCLUSTER",
"env": [
"TASK_ID",
"RUN_ID"
]
},
{
"name": "TeamCity",
"constant": "TEAMCITY",
"env": "TEAMCITY_VERSION"
},
{
"name": "Travis CI",
"constant": "TRAVIS",
"env": "TRAVIS",
"pr": {
"env": "TRAVIS_PULL_REQUEST",
"ne": "false"
}
},
{
"name": "Vela",
"constant": "VELA",
"env": "VELA",
"pr": {
"VELA_PULL_REQUEST": "1"
}
},
{
"name": "Vercel",
"constant": "VERCEL",
"env": {
"any": [
"NOW_BUILDER",
"VERCEL"
]
},
"pr": "VERCEL_GIT_PULL_REQUEST_ID"
},
{
"name": "Visual Studio App Center",
"constant": "APPCENTER",
"env": "APPCENTER_BUILD_ID"
},
{
"name": "Woodpecker",
"constant": "WOODPECKER",
"env": {
"CI": "woodpecker"
},
"pr": {
"CI_BUILD_EVENT": "pull_request"
}
},
{
"name": "Xcode Cloud",
"constant": "XCODE_CLOUD",
"env": "CI_XCODE_PROJECT",
"pr": "CI_PULL_REQUEST_NUMBER"
},
{
"name": "Xcode Server",
"constant": "XCODE_SERVER",
"env": "XCS"
}
]