diff --git a/src/PullRequestReleaseNotes/Publishers/ConfluencePublisher.cs b/src/PullRequestReleaseNotes/Publishers/ConfluencePublisher.cs index 767fe6b..e767d12 100644 --- a/src/PullRequestReleaseNotes/Publishers/ConfluencePublisher.cs +++ b/src/PullRequestReleaseNotes/Publishers/ConfluencePublisher.cs @@ -57,7 +57,12 @@ private static bool PostConfluencePage(ProgramArgs programArgs, string pageTitle Ancestors = new[] { new Ancestor() { Id = programArgs.ConfluenceReleaseParentPageId, Type = "page" } }, Body = new Body { Storage = BuildMarkdownBodyContent(markdown) } }; - return PostConfluenceContent(programArgs, page).StatusCode == HttpStatusCode.OK; + var resp = PostConfluenceContent(programArgs, page); + if (resp.StatusCode != HttpStatusCode.OK) + { + Console.Error.WriteLine($"Failed to publish to confluence: {resp.Content}"); + } + return resp.StatusCode == HttpStatusCode.OK; } private static bool UpdateConfluencePage(ProgramArgs programArgs, Content existingPage, string markdown) @@ -119,7 +124,10 @@ private static RestRequest PrepareConfluenceRequest(RestRequest request) } private static void AddJsonBodyToRequest(Content page, RestRequest request) { - var json = JsonConvert.SerializeObject(page); + var json = JsonConvert.SerializeObject(page, new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + }); request.AddParameter("application/json", json, ParameterType.RequestBody); } }