mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 20:26:49 +00:00
Implement Software Report Base Module (#6707)
* Implement first version * fix tables rendering * Fix scripts * update test files * implement calculate image diff script * Polish code and make e2e validation * remove test files * render add and removed firstly
This commit is contained in:
28
helpers/software-report-base/SoftwareReport.psm1
Normal file
28
helpers/software-report-base/SoftwareReport.psm1
Normal file
@@ -0,0 +1,28 @@
|
||||
using module ./SoftwareReport.BaseNodes.psm1
|
||||
using module ./SoftwareReport.Nodes.psm1
|
||||
|
||||
class SoftwareReport {
|
||||
[HeaderNode] $Root
|
||||
|
||||
SoftwareReport([String] $Title) {
|
||||
$this.Root = [HeaderNode]::new($Title)
|
||||
}
|
||||
|
||||
SoftwareReport([HeaderNode] $Root) {
|
||||
$this.Root = $Root
|
||||
}
|
||||
|
||||
[String] ToJson() {
|
||||
return $this.Root.ToJsonObject() | ConvertTo-Json -Depth 10
|
||||
}
|
||||
|
||||
static [SoftwareReport] FromJson($jsonString) {
|
||||
$jsonObj = $jsonString | ConvertFrom-Json
|
||||
$rootNode = [NodesFactory]::ParseNodeFromObject($jsonObj)
|
||||
return [SoftwareReport]::new($rootNode)
|
||||
}
|
||||
|
||||
[String] ToMarkdown() {
|
||||
return $this.Root.ToMarkdown(1).Trim()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user