public async Task <string> CreatePullRequestAsync(string repoUri, string branch, string assetsProducedInCommit, IEnumerable <Microsoft.DotNet.DarcLib.AssetData> assets, string pullRequestBaseBranch = null, string pullRequestTitle = null, string pullRequestDescription = null) { CheckForValidGitClient(); _logger.LogInformation($"Create pull request to update dependencies in repo '{repoUri}' and branch '{branch}'..."); IEnumerable <DependencyDetail> itemsToUpdate = await GetRequiredUpdatesAsync(repoUri, branch, assetsProducedInCommit, assets); string linkToPr = null; if (itemsToUpdate.Any()) { pullRequestBaseBranch = pullRequestBaseBranch ?? $"darc-{branch}-{Guid.NewGuid()}"; // Base branch must be unique because darc could have multiple PRs open in the same repo at the same time await _gitClient.CreateBranchAsync(repoUri, pullRequestBaseBranch, branch); await CommitFilesForPullRequestAsync(repoUri, branch, assetsProducedInCommit, itemsToUpdate, pullRequestBaseBranch); linkToPr = await _gitClient.CreatePullRequestAsync(repoUri, branch, pullRequestBaseBranch, pullRequestTitle, pullRequestDescription); _logger.LogInformation($"Updating dependencies in repo '{repoUri}' and branch '{branch}' succeeded! PR link is: {linkToPr}"); return(linkToPr); } return(linkToPr); }
public async Task CreateNewBranchAsync(string repoUri, string baseBranch, string newBranch) { await _gitClient.CreateBranchAsync(repoUri, newBranch, baseBranch); }