diff --git a/src/Runner.Common/ConfigurationStore.cs b/src/Runner.Common/ConfigurationStore.cs index 5418fcc51..9b47f85bc 100644 --- a/src/Runner.Common/ConfigurationStore.cs +++ b/src/Runner.Common/ConfigurationStore.cs @@ -1,10 +1,10 @@ -using GitHub.Runner.Sdk; -using System; +using System; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading; +using GitHub.Runner.Sdk; namespace GitHub.Runner.Common { @@ -64,8 +64,20 @@ namespace GitHub.Runner.Common { get { - // Old runners do not have this property. Hosted runners likely don't have this property either. - return _isHostedServer ?? true; + // If the value has been explicitly set, return it. + if (_isHostedServer.HasValue) + { + return _isHostedServer.Value; + } + + // Otherwise, try to infer it from the GitHubUrl. + if (!string.IsNullOrEmpty(GitHubUrl)) + { + return UrlUtil.IsHostedServer(new UriBuilder(GitHubUrl)); + } + + // Default to true since Hosted runners likely don't have this property set. + return true; } set