Add error handling for fetching runners in runner-fallback action

This commit is contained in:
Palash Tyagi 2025-05-05 00:34:48 +01:00
parent 5cca2ca149
commit ac4d67146e

View File

@ -40,6 +40,13 @@ runs:
runners=$(curl -s -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$repo/actions/runners?per_page=100")
# Check if runners is null or empty
if [ -z "$runners" ] || [ "$runners" = "null" ]; then
echo "❌ Error: Unable to fetch runners or no runners found." >&2
exit 1
fi
# Split wanted labels
IFS=',' read -ra WANT <<<"$PRIMARY"
online_found=0