{"id":11098,"library":"is-ci","title":"Detect CI Environment","description":"The `is-ci` package provides a minimalist, direct method for determining whether the current process is executing within a Continuous Integration (CI) environment. It exposes a simple boolean value (`true` if running in CI, `false` otherwise), abstracting away the complexities of checking various environment variables across different CI providers. The current stable version is `4.1.0`. The library typically sees updates in conjunction with its underlying dependency, `ci-info`, which is responsible for the core detection logic, leading to an irregular but feature-driven release cadence. Its primary differentiator is its singular focus on providing a simple boolean answer, making it ideal for conditional logic in build scripts, test runners, or deployment pipelines where CI context is crucial. It supports a wide array of CI services by leveraging `ci-info`'s comprehensive detection capabilities.","status":"active","version":"4.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/watson/is-ci","tags":["javascript","ci","continuous","integration","test","detect","typescript"],"install":[{"cmd":"npm install is-ci","lang":"bash","label":"npm"},{"cmd":"yarn add is-ci","lang":"bash","label":"yarn"},{"cmd":"pnpm add is-ci","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency providing the underlying CI detection logic and information. Changes in `ci-info` directly impact `is-ci`'s behavior, including breaking changes in detected CI platforms.","package":"ci-info","optional":false}],"imports":[{"note":"The `is-ci` package exports a boolean value directly as its default export. Named import is incorrect.","wrong":"import { isCI } from 'is-ci';","symbol":"isCI","correct":"import isCI from 'is-ci';"},{"note":"Standard CommonJS import pattern. The `package.json` specifies `\"type\": \"commonjs\"`.","symbol":"isCI","correct":"const isCI = require('is-ci');"},{"note":"Since v4.1.0, types are exported. The boolean value `isCI` will be correctly inferred as `boolean`.","symbol":"isCI (TypeScript)","correct":"import isCI from 'is-ci';"}],"quickstart":{"code":"import isCI from 'is-ci';\n\nconsole.log(`Checking CI status (ESM):`);\nif (isCI) {\n  console.log('  This code is running on a CI server.');\n} else {\n  console.log('  This code is NOT running on a CI server.');\n}\n\n// For CommonJS environments:\n/*\nconst isCI_cjs = require('is-ci');\nconsole.log(`\\nChecking CI status (CJS):`);\nif (isCI_cjs) {\n  console.log('  This CJS code is running on a CI server.');\n} else {\n  console.log('  This CJS code is NOT running on a CI server.');\n}\n*/\n\n// Example of conditional logic based on CI detection\nif (isCI && process.env.NODE_ENV === 'production') {\n  console.log('\\nRunning production build steps on CI...');\n} else if (!isCI && process.env.NODE_ENV === 'development') {\n  console.log('\\nRunning local development tasks...');\n}","lang":"typescript","description":"Demonstrates how to import and use `is-ci` in both ESM and CJS contexts to conditionally execute code based on CI environment detection."},"warnings":[{"fix":"If your workflows rely on detecting Shippable CI or Solano CI, `is-ci` will no longer identify them. You may need to update your CI configuration or use alternative detection methods for these specific platforms, or consider migrating to a currently supported CI service.","message":"Version 4.0.0 of `is-ci` updated its underlying `ci-info` dependency to v4.0.0, which introduced breaking changes by removing support for certain CI services. Specifically, detection for 'Shippable CI' and 'Solano CI' (formerly 'TDDium') was removed.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Always use `isCI` directly as a boolean expression, e.g., `if (isCI) { ... }`.","message":"The `is-ci` package exports a simple boolean value, not a function or an object with properties. Attempting to call it as a function (`isCI()`) or access properties on it (`isCI.value`) will result in errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'4.1.0':59 'abstract':41 'across':50 'answer':104 'array':128 'away':42 'boolean':32,103 'build':112 'cadenc':91 'capabl':140 'check':46 'ci':2,7,26,38,52,72,120,130,135,142 'ci-info':71,134 'complex':44 'comprehens':138 'condit':109 'conjunct':66 'context':121 'continu':24,143 'core':79 'crucial':123 'current':18,55 'depend':70 'deploy':117 'detect':1,80,139,146 'determin':15 'differ':51 'differenti':94 'direct':12 'driven':89 'environ':3,27,48 'execut':21 'expos':29 'fals':39 'featur':88 'feature-driven':87 'focus':98 'ideal':107 'info':73,136 'integr':25,144 'irregular':85 'is-ci':5 'javascript':141 'lead':82 'leverag':133 'librari':61 'logic':81,110 'make':105 'method':13 'minimalist':11 'otherwis':40 'packag':8 'pipelin':118 'primari':93 'process':19 'provid':9,53,100 'releas':90 'respons':76 'run':36 'runner':115 'script':113 'see':63 'servic':131 'simpl':31,102 'singular':97 'stabl':56 'support':125 'test':114,145 'true':34 'typescript':147 'typic':62 'under':69 'updat':64 'valu':33 'variabl':49 'various':47 'version':57 'whether':16 'wide':127 'within':22","created_at":"2026-04-19T13:36:14.332907+00:00","updated_at":"2026-04-19T13:36:14.332907+00:00","problems":[{"fix":"Use `isCI` directly as a boolean. Correct: `if (isCI) { ... }`. Incorrect: `if (isCI()) { ... }`.","cause":"Attempting to invoke the `isCI` boolean as if it were a function.","error":"TypeError: isCI is not a function"},{"fix":"For ES Modules, use `import isCI from 'is-ci';`. If you must use CommonJS modules, ensure your file is `.js` and your `package.json` does not specify `\"type\": \"module\"`, or use a bundler/transpiler configured for CommonJS.","cause":"Using `require('is-ci')` in an ES Module context (e.g., in a `.mjs` file or a project with `\"type\": \"module\"` in `package.json`) without proper transpilation.","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/watson/is-ci","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/is-ci","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}