forked from couleur-tweak-tips/CTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.ps1
33 lines (21 loc) · 860 Bytes
/
ci.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$ErrorAction = 'Stop'
$DebugPreference = 'Continue'
Push-Location $PSScriptRoot
if (!(Get-Module powershell-yaml)){
Write-Host "Getting PowerShell-YAML.. " -NoNewLine
Install-Module powershell-yaml -Force
Write-Host "Done"
}
. ./lib.ps1
$webhooks = Get-ChildItem ./webhooks/ -Recurse -File
# Gets an array all files within the webhooks folder
foreach ($embed in $webhooks){
$Name = $embed.BaseName
# e.g /webhooks/obs.yaml -> obs
Post-WebHook $embed
Get-Content $Embed -Raw | # 1. Get the content of the file
ConvertFrom-YAML | # 2. Deserialize it into a Hashtable object
ConvertFrom-WebHook | # 3. ConvertFrom-WebHook outputs a multi-line string of markdown
Set-Content ./docs/$Name`.md # 4. Set-Content writes what is piped to a file that has the same name
}
Pop-Location