gpt4 book ai didi

python - 特拉维斯 + 应用程序

转载 作者:行者123 更新时间:2023-12-01 02:33:22 25 4
gpt4 key购买 nike

我正在使用 travis stage,并希望以某种方式包含 appveyor 构建结果作为部署的先决条件。

是否有任何可用的集成或脚本可以执行此操作? python 是理想的选择。

最佳答案

这样的事情可以帮助启动 AppVeyor 构建并等待结果。抱歉,我更喜欢 PowerShell,但它应该很容易转换为 Python。

$token="<Your_api_token>"
$accountName="<Your_account>"
$projectSlug="<Your_project_slug>"
$branch="<Your_branch>"
$commitId="<Your_commit_id>"

$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}

$body = @{
accountName=$accountName
projectSlug=$projectSlug
branch=$branch
commitId=$commitId
}

$body = $body | ConvertTo-Json

$newBuild = Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Body $body -Method POST

$success = $false;
while(!$success) {
$status = (Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$accountName/$projectSlug/build/$($newBuild.version)" -Headers $headers -Method GET).build.status
write-host "Status: $status"
$success = $status -eq "success"
if (($status -eq "failed") -or ($status -eq "cancelled")) {throw}
sleep 2
}

关于python - 特拉维斯 + 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46520026/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com