mirror of
https://github.com/actions/runner.git
synced 2025-12-11 12:57:05 +00:00
Improve logic around decide IsHostedServer. (#4086)
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
using GitHub.Runner.Sdk;
|
using System;
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using GitHub.Runner.Sdk;
|
||||||
|
|
||||||
namespace GitHub.Runner.Common
|
namespace GitHub.Runner.Common
|
||||||
{
|
{
|
||||||
@@ -64,8 +64,20 @@ namespace GitHub.Runner.Common
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Old runners do not have this property. Hosted runners likely don't have this property either.
|
// If the value has been explicitly set, return it.
|
||||||
return _isHostedServer ?? true;
|
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
|
set
|
||||||
|
|||||||
Reference in New Issue
Block a user