ci_info 0.13.2

Provides current CI environment information.

ci_info CI codecov license for GitHub Documentation downloads Built with cargo-make

Provides current CI environment information.


This library main goal is to provide development/build tools such as cargo-make the needed information on the current CI environment. Inspired by the ci-info npm module.


Simply include the library and invoke the get function to pull all info as follows:

Fetching Info

fn main() {
    // Just check if a CI environment is detected.
    let ci = ci_info::is_ci();
    println!("Is CI: {}", ci);

    // Get CI environment information
    let info = ci_info::get();
    println!("Is CI: {}",;
    if let Some(vendor) = info.vendor {
        println!("Vendor: {:#?}", vendor);
        println!("Name: {:#?}",;
    if let Some(pr) = {
        println!("Is PR: {:#?}", pr);
    if let Some(branch_name) = info.branch_name {
        println!("Branch Name: {:#?}", branch_name);

Mocking CI environment

use ci_info::types::{CiInfo, Vendor};

fn main() {
    // create the CI info manually
    let mut mock_info = CiInfo::new();
    mock_info.vendor = Some(Vendor::TravisCI); = true; = Some(true);
    mock_info.branch_name = Some("dev_branch".to_string());

    // mock environment

    let info = ci_info::get();

    assert_eq!(info.vendor.unwrap(), Vendor::TravisCI);
    assert_eq!(, "Travis CI");
    assert_eq!(info.branch_name.unwrap(), "dev_branch");

    // clear CI environment
    mock_info = CiInfo::new();

    let info = ci_info::get();



In order to use this library, just add it as a dependency:

ci_info = "^0.13.2"

There is optional serde support that can be enabled via the serde-1 feature:

ci_info = { version = "*", features = ["serde-1"] }

API Documentation

See full docs at: API Docs


See contributing guide

Release History

See Changelog


Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.