Skip to content

Commit 0af1d57

Browse files
committed
create CiEnv::is_upstream_ci_job
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 6658c8e commit 0af1d57

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

Lines changed: 9 additions & 0 deletions
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 upstream-managed CI job.
24+
pub fn is_upstream_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)