chezmoi/bin/executable_restart-builds-drone.sh

20 lines
542 B
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
drone_url=https://ci.i.kjuulh.io/api/
auth="Authorization: Bearer z1gpPUNI0dAgxtCqvk1aFhyyRn6S1n05"
curl -s "${drone_url}user/repos" -H "$auth" | jq -r .[].slug |
while read -r repo; do
echo "processing $repo"
curl -s "${drone_url}repos/$repo/builds" -H "$auth" | jq -c '.[1:5] | .[] | select(.status | contains("failure")) | .number' | jq -r |
while read -r build_id; do
echo "building: $repo - $build_id"
curl -s -X POST "${drone_url}repos/$repo/builds/$build_id" -H "$auth"
sleep 1
done
done