Skip to content

Commit 2d85139

Browse files
committed
create CiEnv::is_rust_lang_managed_ci_job
Signed-off-by: onur-ozkan <[email protected]>
1 parent 6658c8e commit 2d85139

File tree

1 file changed

+9
-0
lines changed
  • src/tools/build_helper/src

1 file changed

+9
-0
lines changed

src/tools/build_helper/src/ci.rs

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ impl CiEnv {
1919
pub fn is_ci() -> bool {
2020
Self::current() != CiEnv::None
2121
}
22+
23+
/// Checks if running in rust-lang/rust managed CI job.
24+
pub fn is_rust_lang_managed_ci_job() -> bool {
25+
Self::is_ci()
26+
// If both are present, we can assume it's an upstream CI job
27+
// as they are always set unconditionally.
28+
&& std::env::var_os("CI_JOB_NAME").is_some()
29+
&& std::env::var_os("TOOLSTATE_REPO").is_some()
30+
}
2231
}
2332

2433
pub mod gha {

0 commit comments

Comments
 (0)