Skip to content

Commit 78a1ce8

Browse files
🩹 [Refactor]: Enhance XML report output formatting in workflow script for improved readability
1 parent d276cf4 commit 78a1ce8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

‎.github/workflows/workflow.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,22 @@ jobs:
260260
261261
# Output the combined report
262262
$mergedReport.Save("merged-jacoco-report.xml")
263-
$mergedReport | Out-String
263+
264+
# Assuming $mergedReport is your final [xml] object:
265+
$xmlString = $mergedReport.OuterXml
266+
267+
# To format (pretty-print) the XML nicely:
268+
$stringWriter = New-Object System.IO.StringWriter
269+
$xmlWriter = [System.Xml.XmlTextWriter]::new($stringWriter)
270+
$xmlWriter.Formatting = "Indented"
271+
$mergedReport.WriteTo($xmlWriter)
272+
$xmlWriter.Flush()
273+
$prettyXml = $stringWriter.ToString()
274+
275+
$prettyXml | Out-String
276+
277+
# Output or export the XML string
278+
# $prettyXml | Out-File -FilePath "merged-jacoco-report.xml" -Encoding UTF8
264279
265280
266281
# TestModuleStatus:

0 commit comments

Comments
 (0)