Skip to content

Instantly share code, notes, and snippets.

@stephanmg
Last active September 3, 2020 12:21
Show Gist options
  • Save stephanmg/d5b97401f079aa58239f8f5d828efe52 to your computer and use it in GitHub Desktop.
Save stephanmg/d5b97401f079aa58239f8f5d828efe52 to your computer and use it in GitHub Desktop.
trigger_dependent_appveyor_build.ps1
param(
[Parameter(Mandatory=$true)][String]$APPVEYOR_TOKEN="",
[Parameter(Mandatory=$true)][String]$PROJECT_SLUG="",
[String]$APPVEYOR_USER=stephanmg)
if ([string]::IsNullOrWhiteSpace($APPVEYOR_TOKEN)) { "No AppVeyor API token given" }
if ([string]::IsNullOrWhiteSpace($PROJECT_SLUG)) { "No project slug to trigger given" }
if ([string]::IsNullOrWhiteSpace($APPVEYOR_USER)) { "No Appveyor user given }
$headers = @{Authorization = "Bearer $APPVEYOR_TOKEN" }
$body = @{accountName = "$APPVEYOR_USER"; projectSlug = "$PROJECT_SLUG" }
Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Method Post -Body $body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment