whatisgithub

What is moonbit-ci?

justjavac/moonbit-ci — explained in plain English

Analysis updated 2026-08-07 · repo last pushed 2026-07-24

1MoonBitAudience · developerComplexity · 2/5ActiveSetup · easy

In one sentence

A MoonBit library that detects whether your code is running inside a continuous integration service like GitHub Actions or GitLab, and identifies which one. Useful for build scripts that need to behave differently on a server versus a developer's laptop.

Mindmap

mindmap
  root((repo))
    What it does
      Detects CI service
      Returns build details
      Falls back to git
      Supports custom env
    Tech stack
      MoonBit language
      Native backend
      Git CLI
    Use cases
      Richer build logs
      Conditional CI steps
      Artifact tagging
      Simulate CI in tests
    Audience
      Build tool authors
      CI pipeline builders
      MoonBit developers
    Design notes
      Native backend only
      No web assembly
      Async git calls

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Print richer build logs that include the CI service name, branch, and commit hash.

USE CASE 2

Conditionally enable or disable build steps depending on whether the code runs in CI or locally.

USE CASE 3

Tag build artifacts with the originating git branch and commit for traceability.

USE CASE 4

Simulate GitLab or Bitbucket CI conditions in unit tests using a custom environment map.

What is it built with?

MoonBitNative backendGit CLI

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires the MoonBit toolchain and native backend support since the library relies on local git process access and cannot target web assembly.

No license information is provided in the repository explanation, so usage rights are unknown.

So what is it?

justjavac/ci is a MoonBit library that tells a program whether it's currently running inside a continuous integration (CI) service, and if so, which one. This is useful for build scripts or developer tools that need to behave differently when they run on a server like GitHub Actions versus a developer's laptop. The library exposes a few functions. The main one inspects the runtime environment and returns a record with details like the service name, repository slug, git branch, commit hash, and build identifiers. It recognizes about twenty common CI providers, including GitLab, Jenkins, and CircleCI. If it cannot identify a known provider, it falls back to running local git commands to gather the commit and branch, and checks a generic environment variable to guess whether CI is active. A second function lets you pass in a custom environment map, which is handy for testing without actually being on a CI server. Someone building developer tooling in MoonBit would use this to, for example, print richer build logs, conditionally enable steps that should only run in CI, or tag artifacts with the originating branch and commit. A test harness could use the environment-map variant to simulate GitLab or Bitbucket conditions and verify the detection logic without spinning up real pipelines. One notable design choice is that the package only supports the native backend, meaning it compiles to machine code rather than a managed runtime. The README explains this is because the full detection path may call local git commands asynchronously, which requires native process access. The tradeoff is that you cannot use this library from a web assembly target, but the benefit is reliable access to the local git repository when needed.

Copy-paste prompts

Prompt 1
Using the justjavac/ci MoonBit library, write a build script that checks if it is running in CI and prints the service name, branch, and commit hash in a formatted log line.
Prompt 2
Write a MoonBit function that uses the custom environment map variant of justjavac/ci to simulate a GitLab CI environment and assert that the detection logic returns the correct provider.
Prompt 3
Create a MoonBit build step that only runs a deployment task when the CI service is GitHub Actions, using justjavac/ci to detect the environment.
Prompt 4
Show me how to integrate justjavac/ci into a MoonBit project so that build artifacts are tagged with the current git branch and commit hash detected by the library.

Frequently asked questions

What is moonbit-ci?

A MoonBit library that detects whether your code is running inside a continuous integration service like GitHub Actions or GitLab, and identifies which one. Useful for build scripts that need to behave differently on a server versus a developer's laptop.

What language is moonbit-ci written in?

Mainly MoonBit. The stack also includes MoonBit, Native backend, Git CLI.

Is moonbit-ci actively maintained?

Active — commit in last 30 days (last push 2026-07-24).

What license does moonbit-ci use?

No license information is provided in the repository explanation, so usage rights are unknown.

How hard is moonbit-ci to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is moonbit-ci for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.