From 33d2d2c328bed8c2041fee0a90c5f615bb313f74 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Mon, 11 May 2020 11:41:16 -0400 Subject: [PATCH] update checkout@v1 for GHES (#470) --- src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs b/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs index 39fc9dc8440..5c83accce07 100644 --- a/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs +++ b/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs @@ -80,7 +80,12 @@ public async Task GetSourceAsync( // Validate args. ArgUtil.NotNull(executionContext, nameof(executionContext)); executionContext.Output($"Syncing repository: {repoFullName}"); - Uri repositoryUrl = new Uri($"https://github.com/{repoFullName}"); + + // Repository URL + var githubUrl = executionContext.GetGitHubContext("url"); + var githubUri = new Uri(!string.IsNullOrEmpty(githubUrl) ? githubUrl : "https://github.com"); + var portInfo = githubUri.IsDefaultPort ? string.Empty : $":{githubUri.Port}"; + Uri repositoryUrl = new Uri($"{githubUri.Scheme}://{githubUri.Host}{portInfo}/{repoFullName}"); if (!repositoryUrl.IsAbsoluteUri) { throw new InvalidOperationException("Repository url need to be an absolute uri.");