set CI=true when launch process in actions runner. (#374)

This commit is contained in:
Tingluo Huang
2020-03-17 19:58:12 -04:00
committed by GitHub
parent 41f4ca3414
commit a5eb8cb5c4
2 changed files with 105 additions and 0 deletions

View File

@@ -271,6 +271,14 @@ namespace GitHub.Runner.Sdk
// Indicate GitHub Actions process.
_proc.StartInfo.Environment["GITHUB_ACTIONS"] = "true";
// Set CI=true when no one else already set it.
// CI=true is common set in most CI provider in GitHub
if (!_proc.StartInfo.Environment.ContainsKey("CI") &&
Environment.GetEnvironmentVariable("CI") == null)
{
_proc.StartInfo.Environment["CI"] = "true";
}
// Hook up the events.
_proc.EnableRaisingEvents = true;
_proc.Exited += ProcessExitedHandler;