Solving "Deployment request failed due to in progress deployment."

Short guide to solve this problem using Github API

When uploading the previous posts I executed two commits at almost the same time so the deployments failed. From then, all deploys failed:

img

Checking the details in any of them I found this error:

Error: HttpError: Deployment request failed for X due to in progress deployment. Please cancel bcf64b6d972791062f800756412b6795cc892153 first or wait for it to complete.

img

So it seems the problem is the commit “bcf64b6d972791062f800756412b6795cc892153” or “bcf64b6”.

Using Github API you can list deployments with:

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/ricardojoserf/ricardojoserf.github.io/deployments

img

From this I got the deployment id “839873849”, so the url is “https://api.github.com/repos/ricardojoserf/ricardojoserf.github.io/deployments/839873849” and deleted it with:

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/ricardojoserf/ricardojoserf.github.io/deployments/839873849

It seems it is solved, changing anything in any file triggers a new successful deploy:

img

Sources:

Written on March 18, 2023