public async Task UpdateDesignerRoslynVersion() { var currentVersion = await GetDesignerRoslynVersion(); var desiredVersion = await GetVSMRoslynVersion(); if (currentVersion == desiredVersion) { return; } var content = await Designer.GetFileContent(DesignerRoslynVersionFile); var doc = XDocument.Parse(content); GetDesignerRoslynElement(doc.Root) .SetAttributeValue("Version", desiredVersion); var title = $"[{Designer.BranchName}] Bump Roslyn nuget for VSM"; var body = $"Updating from {currentVersion} to {desiredVersion}"; var newFile = doc.ToString(SaveOptions.None); if (doc.Declaration != null) { newFile = doc.Declaration + "\n" + newFile; } // Create a branch from tip of our tracked branch if (await Designer.BranchExists(AutoBumpBranchName)) { await Designer.DeleteBranch(AutoBumpBranchName); } var head = await Designer.GetHeadSha(); var client = await Designer.CreateBranch(AutoBumpBranchName, head); // Update the content on the new branch. await client.UpdateFileContent(title, body, DesignerRoslynVersionFile, newFile); // Issue the PullRequest against the original branch await Designer.CreatePullRequest(AutoBumpBranchName, title, body); }