diff --git a/src/Runner.Listener/Configuration/ConfigurationManager.cs b/src/Runner.Listener/Configuration/ConfigurationManager.cs index ae4f8ad33..e50101591 100644 --- a/src/Runner.Listener/Configuration/ConfigurationManager.cs +++ b/src/Runner.Listener/Configuration/ConfigurationManager.cs @@ -117,6 +117,7 @@ namespace GitHub.Runner.Listener.Configuration try { // Determine the service deployment type based on connection data. (Hosted/OnPremises) + // Hosted usually means github.com or localhost, while OnPremises means GHES or GHAE runnerSettings.IsHostedServer = runnerSettings.GitHubUrl == null || UrlUtil.IsHostedServer(new UriBuilder(runnerSettings.GitHubUrl)); // Warn if the Actions server url and GHES server url has different Host diff --git a/src/Runner.Worker/ContainerOperationProvider.cs b/src/Runner.Worker/ContainerOperationProvider.cs index f8ce2bc04..1a57c393e 100644 --- a/src/Runner.Worker/ContainerOperationProvider.cs +++ b/src/Runner.Worker/ContainerOperationProvider.cs @@ -494,7 +494,8 @@ namespace GitHub.Runner.Worker private void UpdateRegistryAuthForGitHubToken(IExecutionContext executionContext, ContainerInfo container) { var registryIsTokenCompatible = container.RegistryServer.Equals("ghcr.io", StringComparison.OrdinalIgnoreCase) || container.RegistryServer.Equals("containers.pkg.github.com", StringComparison.OrdinalIgnoreCase); - if (!registryIsTokenCompatible) + var isFallbackTokenFromHostedGithub = HostContext.GetService().GetSettings().IsHostedServer; + if (!registryIsTokenCompatible || !isFallbackTokenFromHostedGithub) { return; }