From c9219945fab4428100f13d02f46181c4ed78d8fa Mon Sep 17 00:00:00 2001 From: Daniel Donenfeld Date: Thu, 14 Feb 2019 16:26:34 -0800 Subject: [PATCH] Delete branches for asm on finish --- appveyor.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 260788a..fe97517 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -157,3 +157,16 @@ before_deploy: deploy_script: - cd %APPVEYOR_BUILD_FOLDER% - ps: '& "asm\scripts\deploy-asm.ps1"' + +on_finish: + - ps: | + # Delete all branches for asm + if(-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) { + $build = Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Method GET -Headers @{ + "Authorization" = "Bearer $env:APPVEYOR_API_TOKEN" + "Content-type" = "application/json" + } + $build.build.jobs | Foreach-Object { git push origin --delete asm/$($env:APPVEYOR_REPO_COMMIT)/appveyor-$($_.jobId) } + } + +