ci

    Native-only CI environment detection for MoonBit.

    ci
    continuous-integration
    github-actions
    gitlab-ci
    native
    Download zip
    Author
    Version
    0.1.1
    License
    MIT
    Last updated
    3 months ago
    Downloads
    4K

    Dependencies

    #justjavac/ci

    CI coverage linux macos windows

    Native-only CI environment detection for MoonBit.

    ///|
    async test "detect current ci environment" {
    let info = @ci.env_ci()
    ignore(info.is_ci)
    ignore(info.service)
    ignore(info.branch)
    }

    Info

    pub(all) struct Info {
    name : String
    service : String
    is_ci : Bool
    commit : String?
    tag : String?
    build : String?
    build_url : String?
    branch : String?
    job : String?
    job_url : String?
    is_pr : Bool?
    pr : String?
    pr_branch : String?
    slug : String?
    root : String?
    } derive(Eq, ToJson,
    Debug
    )

    CI environment details collected from well-known provider variables.

    Fields that a provider cannot expose are None. The name field is the human-readable service name and service is a stable lowercase identifier. is_ci is always present so callers can distinguish a local git fallback from a real CI service.

    detect_from_env

    fn detect_from_env(env : Map[String, String]) -> Info?

    Detect CI information from environment variables only.

    This pure entry point does not run git commands or read provider event files. Use env_ci_from when you also want the local git fallback.

    env_ci

    async fn env_ci(cwd? : String) -> Info

    Detect CI information from the current process environment.

    If no known provider is detected, this falls back to local git metadata and sets is_ci from the generic CI environment variable.

    env_ci_from

    async fn env_ci_from(env : Map[String, String], cwd? : String) -> Info

    Detect CI information from an explicit environment map.

    This is the deterministic entry point for tests and callers that already captured an environment. Provider-specific environment variables are checked first. If none match, the function runs small git commands in cwd to fill commit and branch, matching the fallback behavior of deno-ci.

    is_ci

    async fn is_ci(cwd? : String) -> Bool

    Return whether the current process appears to be running in CI.

    name

    async fn name(cwd? : String) -> String

    Return the current CI service display name, or unknown for the git fallback.

    service

    async fn service(cwd? : String) -> String

    Return the current CI service identifier, or unknown for the git fallback.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io