From ac4d67146e8d676a0d6c715530b5bb40e1d9f0bf Mon Sep 17 00:00:00 2001 From: Palash Tyagi <23239946+Magnus167@users.noreply.github.com> Date: Mon, 5 May 2025 00:34:48 +0100 Subject: [PATCH] Add error handling for fetching runners in runner-fallback action --- .github/actions/runner-fallback/action.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/actions/runner-fallback/action.yml b/.github/actions/runner-fallback/action.yml index 9b320f2..8abc9d6 100644 --- a/.github/actions/runner-fallback/action.yml +++ b/.github/actions/runner-fallback/action.yml @@ -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