private static async Task RequestBenchmark(PRBenchmarkRequest prBenchmarkRequest, string newJobFileName) { await using var baseJobStream = File.OpenRead(BaseJobPath); var jsonDictionary = await JsonSerializer.DeserializeAsync <Dictionary <string, object> >(baseJobStream); jsonDictionary[nameof(BuildInstructions)] = new BuildInstructions { BuildCommands = BaseBuildInstructions.BuildCommands, ExtraDriverArgs = BaseBuildInstructions.ExtraDriverArgs, PullRequestNumber = prBenchmarkRequest.PullRequest.Number, BaselineSHA = prBenchmarkRequest.PullRequest.Base.Sha, PullRequestSHA = prBenchmarkRequest.PullRequest.Head.Sha, ScenarioName = prBenchmarkRequest.ScenarioName, }; using var newJobStream = new MemoryStream(); await JsonSerializer.SerializeAsync(newJobStream, jsonDictionary, new JsonSerializerOptions { WriteIndented = true, }); newJobStream.Position = 0; await JobFileSystem.WriteFile(newJobStream, newJobFileName); }
private static async Task RequestBenchmark(PullRequest pr, string newJobFileName) { await using var baseJobStream = File.OpenRead(BaseJobPath); var jsonDictionary = await JsonSerializer.DeserializeAsync <Dictionary <string, object> >(baseJobStream); jsonDictionary["BuildInstructions"] = new BuildInstructions { BuildCommands = BuildCommands, BaselineSHA = pr.Base.Sha, PullRequestSHA = pr.Head.Sha, }; using var newJobStream = new MemoryStream(); await JsonSerializer.SerializeAsync(newJobStream, jsonDictionary, new JsonSerializerOptions { WriteIndented = true, }); newJobStream.Position = 0; await JobFileSystem.WriteFile(newJobStream, newJobFileName); }