Skip to content

Commit

Permalink
create CiEnv::is_rust_lang_managed_ci_job
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Sep 29, 2024
1 parent 6658c8e commit 2d85139
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tools/build_helper/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ impl CiEnv {
pub fn is_ci() -> bool {
Self::current() != CiEnv::None
}

/// Checks if running in rust-lang/rust managed CI job.
pub fn is_rust_lang_managed_ci_job() -> bool {
Self::is_ci()
// If both are present, we can assume it's an upstream CI job
// as they are always set unconditionally.
&& std::env::var_os("CI_JOB_NAME").is_some()
&& std::env::var_os("TOOLSTATE_REPO").is_some()
}
}

pub mod gha {
Expand Down

0 comments on commit 2d85139

Please sign in to comment.