mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Fixes ENG-21481 Updates ci_info to include more CIs. It makes it codegen the ci detection based on the json from the ci-info package. Also it supports setting CI=true to force ci detected. --------- Co-authored-by: pfg <pfg@pfg.pw> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
28 lines
917 B
Zig
28 lines
917 B
Zig
// A modified port of ci-info@4.0.0 (https://github.com/watson/ci-info)
|
|
// Only gets the CI name, `isPR` is not implemented.
|
|
// Main implementation is in src/codegen/ci_info.ts
|
|
|
|
var detectCIOnce = bun.once(detectUncached);
|
|
var isCIOnce = bun.once(isCIUncached);
|
|
|
|
/// returns true if the current process is running in a CI environment
|
|
pub fn isCI() bool {
|
|
return isCIOnce.call(.{});
|
|
}
|
|
|
|
/// returns the CI name, or null if the CI name could not be determined. note that this can be null even if `isCI` is true.
|
|
pub fn detectCIName() ?[]const u8 {
|
|
return detectCIOnce.call(.{});
|
|
}
|
|
|
|
fn isCIUncached() bool {
|
|
return bun.env_var.CI.get() orelse generated.isCIUncachedGenerated() or detectCIName() != null;
|
|
}
|
|
fn detectUncached() ?[]const u8 {
|
|
if (bun.env_var.CI.get() == false) return null;
|
|
return generated.detectUncachedGenerated();
|
|
}
|
|
|
|
const bun = @import("bun");
|
|
const generated = @import("ci_info");
|