steinbrueckri / steinbrueckri.io

my personal website
https://steinbrueck.io
1 stars 0 forks source link

Delete old Github Pages Environment #12

Closed steinbrueckri closed 3 years ago

steinbrueckri commented 3 years ago

image

steinbrueckri commented 3 years ago
#!/bin/bash

env=github-pages
token=
repo=steinbrueckri.github.io
user=steinbrueckri

for id in $(curl -u $user:$token https://api.github.com/repos/$user/$repo/deployments\?environment\=$env | jq ".[].id"); do
    curl -X POST -u $user:$token -d '{"state":"inactive"}' -H 'accept: application/vnd.github.ant-man-preview+json' https://api.github.com/repos/$user/$repo/deployments/$id/statuses
    curl -X DELETE -u $user:$token https://api.github.com/repos/$user/$repo/deployments/$id
done