Last active
April 23, 2025 08:15
-
-
Save OwenMcDonnell/01e215d1615e75e871ecf2418224ca96 to your computer and use it in GitHub Desktop.
check validity of yaml file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Param( | |
| [string]$yamlPath | |
| ) | |
| if(!(test-path $yamlPath)) { write-warning "YAML path is invalid"; return; } | |
| $token = "<your_token>" | |
| $headers = @{ | |
| "Authorization" = "Bearer $token" | |
| "Content-type" = "application/json" | |
| } | |
| $body = get-content $yamlPath -raw | |
| $result = Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects/validate-yaml' -Method Post -Headers $headers -Body $body | |
| if ($result.isValid) { write-host "Yaml is valid!" } else { write-host "Yaml is not valid -> error: $($result.errorMessage)" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment