{"id":17002145,"url":"https://github.com/sagiegurari/ci_info","last_synced_at":"2025-03-17T09:30:55.879Z","repository":{"id":57553336,"uuid":"106440627","full_name":"sagiegurari/ci_info","owner":"sagiegurari","description":"Provides current CI environment information.","archived":false,"fork":false,"pushed_at":"2024-01-13T16:36:30.000Z","size":4794,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T15:23:51.396Z","etag":null,"topics":["appveyor","build","build-automation","ci","continuous-integration","rust","rust-library","travis","travis-ci"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagiegurari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-10T16:09:20.000Z","updated_at":"2024-06-01T17:44:59.949Z","dependencies_parsed_at":"2024-01-13T17:37:18.646Z","dependency_job_id":"09fbc378-2641-4dcc-8c26-cd13fb2f84ba","html_url":"https://github.com/sagiegurari/ci_info","commit_stats":{"total_commits":147,"total_committers":5,"mean_commits":29.4,"dds":0.04761904761904767,"last_synced_commit":"1749b6dbe8012b29ab19da5c5e4c49dba2820bc6"},"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fci_info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fci_info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fci_info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fci_info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagiegurari","download_url":"https://codeload.github.com/sagiegurari/ci_info/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243858929,"owners_count":20359260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appveyor","build","build-automation","ci","continuous-integration","rust","rust-library","travis","travis-ci"],"created_at":"2024-10-14T04:27:09.060Z","updated_at":"2025-03-17T09:30:55.317Z","avatar_url":"https://github.com/sagiegurari.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ci_info\n\n[![crates.io](https://img.shields.io/crates/v/ci_info.svg)](https://crates.io/crates/ci_info) [![CI](https://github.com/sagiegurari/ci_info/workflows/CI/badge.svg?branch=master)](https://github.com/sagiegurari/ci_info/actions) [![codecov](https://codecov.io/gh/sagiegurari/ci_info/branch/master/graph/badge.svg)](https://codecov.io/gh/sagiegurari/ci_info)\u003cbr\u003e\n[![license](https://img.shields.io/crates/l/ci_info.svg)](https://github.com/sagiegurari/ci_info/blob/master/LICENSE) [![Libraries.io for GitHub](https://img.shields.io/librariesio/github/sagiegurari/ci_info.svg)](https://libraries.io/cargo/ci_info) [![Documentation](https://docs.rs/ci_info/badge.svg)](https://docs.rs/crate/ci_info/) [![downloads](https://img.shields.io/crates/d/ci_info.svg)](https://crates.io/crates/ci_info)\u003cbr\u003e\n[![Built with cargo-make](https://sagiegurari.github.io/cargo-make/assets/badges/cargo-make.svg)](https://sagiegurari.github.io/cargo-make)\n\n\u003e Provides current CI environment information.\n\n* [Overview](#overview)\n* [Usage](#usage)\n* [Installation](#installation)\n* [API Documentation](https://sagiegurari.github.io/ci_info/)\n* [Contributing](.github/CONTRIBUTING.md)\n* [Release History](CHANGELOG.md)\n* [License](#license)\n\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\n## Overview\nThis library main goal is to provide development/build tools such as [cargo-make](https://sagiegurari.github.io/cargo-make/) the needed information on the current CI environment.\u003cbr\u003e\nInspired by the [ci-info](https://github.com/watson/ci-info) npm module.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n## Usage\nSimply include the library and invoke the get function to pull all info as follows:\n\n### Fetching Info\n\n\u003c!--{ \"examples/get.rs\" | lines: 3 | code: rust }--\u003e\n```rust\nfn main() {\n    // Just check if a CI environment is detected.\n    let ci = ci_info::is_ci();\n    println!(\"Is CI: {}\", ci);\n\n    // Get CI environment information\n    let info = ci_info::get();\n    println!(\"Is CI: {}\", info.ci);\n    if let Some(vendor) = info.vendor {\n        println!(\"Vendor: {:#?}\", vendor);\n        println!(\"Name: {:#?}\", info.name.unwrap());\n    }\n    if let Some(pr) = info.pr {\n        println!(\"Is PR: {:#?}\", pr);\n    }\n    if let Some(branch_name) = info.branch_name {\n        println!(\"Branch Name: {:#?}\", branch_name);\n    }\n}\n```\n\u003c!--{ end }--\u003e\n\n### Mocking CI environment\n\n\u003c!--{ \"examples/mock.rs\" | lines: 2 | code: rust }--\u003e\n```rust\nuse ci_info::types::{CiInfo, Vendor};\n\nfn main() {\n    // create the CI info manually\n    let mut mock_info = CiInfo::new();\n    mock_info.vendor = Some(Vendor::TravisCI);\n    mock_info.ci = true;\n    mock_info.pr = Some(true);\n    mock_info.branch_name = Some(\"dev_branch\".to_string());\n\n    // mock environment\n    ci_info::mock_ci(\u0026mock_info);\n\n    let info = ci_info::get();\n\n    assert!(info.ci);\n    assert!(info.pr.unwrap());\n    assert_eq!(info.vendor.unwrap(), Vendor::TravisCI);\n    assert_eq!(info.name.unwrap(), \"Travis CI\");\n    assert_eq!(info.branch_name.unwrap(), \"dev_branch\");\n\n    // clear CI environment\n    mock_info = CiInfo::new();\n    ci_info::mock_ci(\u0026mock_info);\n\n    let info = ci_info::get();\n\n    assert!(!info.ci);\n}\n```\n\u003c!--{ end }--\u003e\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n## Installation\nIn order to use this library, just add it as a dependency:\n\n```ini\n[dependencies]\nci_info = \"^0.14.14\"\n```\n\nThere is optional `serde` support that can be enabled via the `serde-1` feature:\n\n```ini\n[dependencies]\nci_info = { version = \"*\", features = [\"serde-1\"] }\n```\n\n## API Documentation\nSee full docs at: [API Docs](https://sagiegurari.github.io/ci_info/)\n\n## Contributing\nSee [contributing guide](.github/CONTRIBUTING.md)\n\n\u003ca name=\"history\"\u003e\u003c/a\u003e\n## Release History\n\nSee [Changelog](CHANGELOG.md)\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\nDeveloped by Sagie Gur-Ari and licensed under the Apache 2 open source license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fci_info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagiegurari%2Fci_info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fci_info/lists"}