Skip to content

Instantly share code, notes, and snippets.

@OwenMcDonnell
Last active April 23, 2025 08:15
Show Gist options
  • Select an option

  • Save OwenMcDonnell/01e215d1615e75e871ecf2418224ca96 to your computer and use it in GitHub Desktop.

Select an option

Save OwenMcDonnell/01e215d1615e75e871ecf2418224ca96 to your computer and use it in GitHub Desktop.
check validity of yaml file
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