diff options
| author | onur-ozkan <work@onurozkan.dev> | 2024-09-25 19:48:15 +0300 |
|---|---|---|
| committer | onur-ozkan <work@onurozkan.dev> | 2024-09-29 07:19:23 +0300 |
| commit | 2d85139f87f52f28172be61c2957d8f856b3d9ac (patch) | |
| tree | d558964a907e1af080756ea675cb6203a2142740 | |
| parent | 6658c8e2449fb6a674ac606823e43c44f3caf275 (diff) | |
| download | rust-2d85139f87f52f28172be61c2957d8f856b3d9ac.tar.gz rust-2d85139f87f52f28172be61c2957d8f856b3d9ac.zip | |
create `CiEnv::is_rust_lang_managed_ci_job`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
| -rw-r--r-- | src/tools/build_helper/src/ci.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/build_helper/src/ci.rs b/src/tools/build_helper/src/ci.rs index 6d79c7c83ad..60f319129a0 100644 --- a/src/tools/build_helper/src/ci.rs +++ b/src/tools/build_helper/src/ci.rs @@ -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 { |
