Skip to content

Commit 5bbf311

Browse files
authored
Merge pull request #9 from goodworkaround/copilot/add-support-for-output-to-azure-devops
feat: Add -AzureDevOps switch for ADO-compatible mermaid output
2 parents 6b628ad + 68f149e commit 5bbf311

3 files changed

Lines changed: 32 additions & 7 deletions

File tree

Documentation.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ A module for simplifying the process of getting an access token from Entra ID
1717
### SYNTAX
1818

1919
```
20-
Invoke-LCWMermaidGenerator [[-ReportPath] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
20+
Invoke-LCWMermaidGenerator [[-ReportPath] <String>] [-AzureDevOps] [-ProgressAction <ActionPreference>]
21+
[<CommonParameters>]
2122
```
2223

2324
### DESCRIPTION
@@ -34,6 +35,21 @@ PS C:\> {{ Add example code here }}
3435

3536
### PARAMETERS
3637

38+
#### -AzureDevOps
39+
40+
41+
```yaml
42+
Type: SwitchParameter
43+
Parameter Sets: (All)
44+
Aliases:
45+
46+
Required: False
47+
Position: Named
48+
Default value: None
49+
Accept pipeline input: False
50+
Accept wildcard characters: False
51+
```
52+
3753
#### -ReportPath
3854
3955

LCWMermaidGenerator/Private/ConvertTo-WorkflowMarkdown.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function ConvertTo-WorkflowMarkdown {
22
param(
3-
$WorkflowRecord
3+
$WorkflowRecord,
4+
[switch] $AzureDevOps
45
)
56

67
$lines = [System.Collections.Generic.List[string]]::new()
@@ -58,9 +59,16 @@ function ConvertTo-WorkflowMarkdown {
5859

5960
$lines.Add('### Mermaid')
6061
$lines.Add('')
61-
$lines.Add('```mermaid')
62-
$lines.Add((ConvertTo-WorkflowMermaid -WorkflowRecord $WorkflowRecord))
63-
$lines.Add('```')
62+
if ($AzureDevOps) {
63+
$lines.Add(':::mermaid')
64+
$lines.Add((ConvertTo-WorkflowMermaid -WorkflowRecord $WorkflowRecord))
65+
$lines.Add(':::')
66+
}
67+
else {
68+
$lines.Add('```mermaid')
69+
$lines.Add((ConvertTo-WorkflowMermaid -WorkflowRecord $WorkflowRecord))
70+
$lines.Add('```')
71+
}
6472
$lines.Add('')
6573

6674
return ($lines -join [Environment]::NewLine)

LCWMermaidGenerator/Public/Invoke-LCWMermaidGenerator.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
function Invoke-LCWMermaidGenerator {
22
[CmdletBinding()]
33
param (
4-
[string] $ReportPath = 'LifecycleWorkflowsReport.md'
4+
[string] $ReportPath = 'LifecycleWorkflowsReport.md',
5+
[switch] $AzureDevOps
56
)
67

78
process {
@@ -47,7 +48,7 @@ function Invoke-LCWMermaidGenerator {
4748
$reportSections.Add('')
4849

4950
foreach ($workflowRecord in $workflowRecords) {
50-
$reportSections.Add((ConvertTo-WorkflowMarkdown -WorkflowRecord $workflowRecord))
51+
$reportSections.Add((ConvertTo-WorkflowMarkdown -WorkflowRecord $workflowRecord -AzureDevOps:$AzureDevOps))
5152
}
5253

5354
$reportContent = $reportSections -join [Environment]::NewLine

0 commit comments

Comments
 (0)