Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@npmcli/ci-detect
Advanced tools
@npmcli/ci-detect is a utility package that helps detect if your code is running in a Continuous Integration (CI) environment. It can identify various CI services and provide information about the environment.
Detect CI Environment
This feature allows you to detect if your code is running in a CI environment and returns the name of the CI service if detected. The code sample demonstrates how to use the package to get the CI service name.
const ciDetect = require('@npmcli/ci-detect');
const ciName = ciDetect();
console.log(`Running in CI: ${ciName}`);
Check Specific CI Service
This feature allows you to check if your code is running on a specific CI service. The code sample shows how to check if the environment is Travis CI.
const ciDetect = require('@npmcli/ci-detect');
const isTravis = ciDetect() === 'travis';
console.log(`Is Travis CI: ${isTravis}`);
ci-info is a package that provides information about the current Continuous Integration environment. It can detect various CI services and provide details about the environment. Compared to @npmcli/ci-detect, ci-info offers more detailed information about the CI environment, including whether the environment is a pull request.
is-ci is a simple package that checks if the code is running in a CI environment. It returns a boolean value indicating whether the environment is a CI service. Compared to @npmcli/ci-detect, is-ci is more straightforward and only provides a boolean result without specifying the CI service name.
Detect what kind of CI environment the program is in
const ciDetect = require('@npmcli/ci-detect')
// false if not in CI
// otherwise, a string indicating the CI environment type
const inCI = ciDetect()
Returns one of the following strings, or false
if none match, by looking
at the appropriate environment variables.
CI_NAME
environment variable will return the
value as the result. (This is how CodeShip is detected.)'aws-codebuild'
AWS CodeBuild'azure-pipelines'
Azure Pipelines'bamboo'
Bamboo'bitbucket-pipelines'
Bitbucket Pipelines'bitrise'
Bitrise'buddy'
Buddy'builder'
Google Cloud Builder - This one is a bit weird. It
doesn't really set anything that can be reliably detected except
BUILDER_OUTPUT
, so it can get false positives pretty easily.'buildkite'
Buildkite'circleci'
Circle-CI'cirrus'
Cirrus CI'codeship'
CodeShip'custom'
anything else that sets CI
environment variable to either
'1'
or 'true'
.'drone'
Drone'dsari'
dsari CI'gerrit'
Gerrit'github-actions'
GitHub Actions'gitlab'
GitLab'gocd'
GoCD'heroku'
Heroku'hudson'
Hudson CI'jenkins'
Jenkins'magnum'
Magnum CI'netlify'
Netlify'nevercode'
Nevercode'now'
Zeit.co's Now service, but not GitHub/BitBucket/GitLab'now-bitbucket'
Zeit.co's Now for BitBucket deployment service'now-github'
Zeit.co's Now for GitHub deployment service'now-gitlab'
Zeit.co's Now for GitLab deployment service'render'
Render CI'sail'
Sail CI'screwdriver'
Screwdriver CI'semaphore'
Semaphore'shippable'
Shippable'strider'
Strider CI'taskcluster'
Mozilla Taskcluster'tddium'
TDDium'teamcity'
TeamCity'travis-ci'
Travis-CI - A few other CI systems set TRAVIS=1
in the
environment, because devs use that to indicate "test mode", so this
one can get some false positives, and is tested later in the process
to minimize this effect.'vercel'
Vercel'vercel-bitbucket'
Vercel Bitbucket'vercel-github'
Vercel GitHub'vercel-gitlab'
Vercel Gitlab'wercker'
Oracle Wercker'woodpecker'
Woodpecker CISince any program can set or unset whatever environment variables they want, this is not 100% reliable.
Also, if your program does different behavior in CI/test/deployment than other places, then there's a good chance that you're doing something wrong!
But, for little niceties like setting colors or other output parameters, or logging and that sort of non-essential thing, this module provides a way to tweak without checking a bunch of things in a bunch of places. Mostly, it's a single place to keep a note of what CI system sets which environment variable.
FAQs
Detect what kind of CI environment the program is in
The npm package @npmcli/ci-detect receives a total of 303,449 weekly downloads. As such, @npmcli/ci-detect popularity was classified as popular.
We found that @npmcli/ci-detect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.