返回

Github-Pages deploy error 佈屬失敗解決(報錯原因Deployment request failed for xxx due to in progress,Please cancel xxxx first or wait for it to complete)

Github-Pages 突然佈屬失敗(deploy error),報錯原因Deployment request failed for xxx due to in progress,Please cancel xxxx first or wait for it to complete,解決方式,用Github API去刪除,報錯訊息提供的佈屬ID

目錄

報錯畫面

突然開始,佈屬皆會報錯

報錯原因

打API查詢佈屬ID

# <TOKEN> 更換您的GITHUB TOKEN
# grep id 更換成您報錯頁面提示的ID 

chenqingze@chenqingze-MBP ~ % curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/chingtsechen/chingtsechen.github.io/deployments | grep -i -B 40 f011f3e1c2edc5fa42d95fe890265994405a045a

就可以看到,佈屬IP

    "url": "https://api.github.com/repos/chingtsechen/chingtsechen.github.io/deployments/1156464224",
    "id": 1156464224,

先將佈屬ID狀態設定為inactive

如果直接執行刪除,會出現以下報錯

chenqingze@chenqingze-MBP ~ % curl -L \
  -X DELETE \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/chingtsechen/chingtsechen.github.io/deployments/1156464224
{
  "message": "Validation Failed",
  "errors": [
    "We cannot delete an active deployment unless it is the only deployment in a given environment."
  ],
  "documentation_url": "https://docs.github.com/rest/deployments/deployments#delete-a-deployment"
}

所以需要先將佈屬ID狀態設定為inactive

curl https://api.github.com/repos/chingtsechen/chingtsechen.github.io/deployments/1156464224/statuses -X POST -d '{"state":"inactive"}' -H 'accept: application/vnd.github.ant-man-preview+json' -H "authorization: token <TOKEN>"

用API刪除佈屬ID

curl -L \
  -X DELETE \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/chingtsechen/chingtsechen.github.io/deployments/1156464224 

可以成功繼續佈屬

可以看到,佈屬成功了

comments powered by Disqus
使用 Hugo 建立
主題 StackJimmy 設計
發表了128篇文章 · 總計63.96k字
本站已運行
·