Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

env-ci

Package Overview
Dependencies
Maintainers
4
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-ci

Get environment variables exposed by CI services

  • 11.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
decreased by-12.8%
Maintainers
4
Weekly downloads
 
Created

What is env-ci?

The env-ci npm package is designed to detect the CI environment in which your code is running. It provides information about the Continuous Integration (CI) service, such as the branch name, commit SHA, and other relevant details. This can be useful for customizing behavior based on the CI environment.

What are env-ci's main functionalities?

Detect CI Environment

This feature allows you to detect if your code is running in a CI environment and provides details about the CI service, branch, and commit. The code sample demonstrates how to use the env-ci package to retrieve and log this information.

const envCi = require('env-ci');
const { isCi, service, branch, commit } = envCi();
console.log(`Running on CI: ${isCi}`);
console.log(`CI Service: ${service}`);
console.log(`Branch: ${branch}`);
console.log(`Commit: ${commit}`);

Custom CI Services

This feature allows you to add custom CI services to the detection logic. The code sample demonstrates how to configure a custom CI service and retrieve information about the branch and commit.

const envCi = require('env-ci');
const { isCi, service, branch, commit } = envCi({
  services: [
    {
      name: 'custom-ci',
      detect: () => Boolean(process.env.CUSTOM_CI),
      configuration: () => ({
        branch: process.env.CUSTOM_CI_BRANCH,
        commit: process.env.CUSTOM_CI_COMMIT
      })
    }
  ]
});
console.log(`Running on CI: ${isCi}`);
console.log(`CI Service: ${service}`);
console.log(`Branch: ${branch}`);
console.log(`Commit: ${commit}`);

Other packages similar to env-ci

Keywords

FAQs

Package last updated on 27 Aug 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc