private async Task <RepoConfig> FetchConfigFromGithub(string owner, string repo) { var file = await fileRetriever.GetFile(owner, repo, REPO_CONFIG_FILE_NAME); if (file == null) { logger.WithExtraData(new { owner, repo }).Warning("No config file found for repo"); return(new RepoConfig { Repo = repo, Owner = owner }); } var decoded = file.DecodeContent <RepoConfig>(); decoded.Owner = owner; decoded.Repo = repo; decoded.UpdatedAt = DateTime.UtcNow; if (!decoded.IsValidMergePolicy()) { decoded.MergePolicy = "whitelist"; logger.WithExtraData(new { decoded }).Warning("Invalid miro yml configuration given for merge policy"); } if (!decoded.IsValidUpdateBranchStrategy()) { decoded.UpdateBranchStrategy = "oldest"; logger.WithExtraData(new { decoded }).Warning("Invalid miro yml configuration given for update branch strategy"); } return(decoded); }
public string GetFile(object repositoryId, long version, TemporaryDirectory tempDir) { if (fileRetriever == null) { fileRetriever = new FileRetriever(this.connectionSettings); } return(fileRetriever.GetFile((string)repositoryId, version, tempDir)); }