private GitObject GetReadMeGitObject(string productRepoName, string readmePath) { string fullPath = Path.Combine(Manifest.Directory, readmePath); string updatedReadMe = File.ReadAllText(fullPath); updatedReadMe = ReadmeHelper.UpdateTagsListing(updatedReadMe, McrTagsPlaceholder); return(GetGitObject(productRepoName, fullPath, updatedReadMe)); }
private GitObject GetReadMeGitObject(string productRepoName, string readmePath, bool containsTagListing) { string updatedReadMe = File.ReadAllText(readmePath); if (containsTagListing) { updatedReadMe = ReadmeHelper.UpdateTagsListing(updatedReadMe, McrTagsPlaceholder); } return(GetGitObject(productRepoName, readmePath, updatedReadMe)); }
public static void UpdateReadme(RepoInfo repo, string tagsListing) { Logger.WriteHeading("UPDATING README"); string readme = File.ReadAllText(repo.Model.ReadmePath); readme = ReadmeHelper.UpdateTagsListing(readme, tagsListing); File.WriteAllText(repo.Model.ReadmePath, readme); Logger.WriteSubheading($"Updated '{repo.Model.ReadmePath}'"); Logger.WriteMessage(); }
private string UpdateTagsListing(string readme, RepoInfo repo) { if (repo.Model.McrTagsMetadataTemplate == null) { return(readme); } string tagsMetadata = McrTagsMetadataGenerator.Execute( _gitService, Manifest, repo, Options.SourceRepoUrl, Options.SourceRepoBranch); string tagsListing = GenerateTagsListing(repo, tagsMetadata); return(ReadmeHelper.UpdateTagsListing(readme, tagsListing)); }
private async Task <GitObject[]> GetUpdatedReadmes(string productRepo, IGitHubClient client, GitHubBranch branch) { List <GitObject> readmes = new List <GitObject>(); List <string> readmePaths = Manifest.FilteredRepos .Select(repo => repo.Model.ReadmePath) .ToList(); if (!string.IsNullOrEmpty(Manifest.Model.ReadmePath)) { readmePaths.Add(Manifest.Model.ReadmePath); } foreach (string readmePath in readmePaths) { string fullPath = Path.Combine(Manifest.Directory, readmePath); string updatedReadMe = File.ReadAllText(fullPath); updatedReadMe = ReadmeHelper.UpdateTagsListing(updatedReadMe, McrTagsPlaceholder); await AddUpdatedFile(readmes, client, branch, productRepo, fullPath, updatedReadMe); } return(readmes.ToArray()); }