This commit is contained in:
TingluoHuang
2021-09-01 13:20:09 -04:00
parent 400b2d879c
commit fe6719d120

View File

@@ -33,16 +33,24 @@ namespace GitHub.Runner.Worker
"sha",
"workflow",
"workspace",
"ref_protected",
};
public IEnumerable<KeyValuePair<string, string>> GetRuntimeEnvironmentVariables()
{
foreach (var data in this)
{
if (_contextEnvAllowlist.Contains(data.Key) && data.Value is StringContextData value)
if (_contextEnvAllowlist.Contains(data.Key))
{
if (data.Value is StringContextData value)
{
yield return new KeyValuePair<string, string>($"GITHUB_{data.Key.ToUpperInvariant()}", value);
}
else if (data.Value is BooleanContextData booleanValue)
{
yield return new KeyValuePair<string, string>($"GITHUB_{data.Key.ToUpperInvariant()}", booleanValue.ToString());
}
}
}
}