public override async Task <(string cloneLocation, Dictionary <string, string> outputValues, string errorMessage)> Clone() { var cloneLocation = CloneTaskConfig.CloneLocation ?? CloneTaskConfig.WorkingLocation; var repoConfig = GetGitAutomationConfig(cloneLocation, CloneTaskConfig.Repository, AdditionalConfigs, CloneTaskConfig.IsPrivateRepository); if (_gitAutomation == null) { _gitAutomation = new GitAutomation(repoConfig, _gitHubUtils, Logger); } var error = await _gitAutomation.CreateRepositoryIfNotExists(); if (!string.IsNullOrEmpty(error)) { return("", null, error); } error = await _gitAutomation.Clone(); if (!string.IsNullOrEmpty(error)) { return("", null, error); } if (!string.IsNullOrEmpty(CloneTaskConfig.BaseBranch)) { await _gitAutomation.CheckoutBranch(CloneTaskConfig.BaseBranch); } return(cloneLocation, null, ""); }
public override async Task <(string repositoryLocation, Dictionary <string, string> outputValues, string errorMessage)> Pull() { var repositoryLocation = PullTaskConfig.RepositoryLocation ?? PullTaskConfig.WorkingLocation; var repoConfig = GetGitAutomationConfig(repositoryLocation, PullTaskConfig.Repository, AdditionalConfigs, PullTaskConfig.IsPrivateRepository, ProjectMembers); if (_gitAutomation == null) { _gitAutomation = new GitAutomation(repoConfig, _gitHubUtils, Logger); } var error = await _gitAutomation.CreateRepositoryIfNotExists(); if (!string.IsNullOrEmpty(error)) { return("", null, error); } error = await _gitAutomation.CloneIfNotExistLocally(); if (!string.IsNullOrEmpty(error)) { return("", null, error); } if (!string.IsNullOrEmpty(PullTaskConfig.BaseBranch)) { await _gitAutomation.CheckoutBranch(PullTaskConfig.BaseBranch); } else { await _gitAutomation.CheckoutBranch(DefaultBaseBranch); } error = await _gitAutomation.Pull(DefaultAuthor, DefaultEmail); if (!string.IsNullOrEmpty(error)) { return("", null, error); } return(repositoryLocation, null, ""); }