目錄
報錯畫面
突然開始,佈屬皆會報錯
報錯原因
打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
可以成功繼續佈屬
可以看到,佈屬成功了