Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/monitor_selfhosted_runners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
org_names=$(jq -r '.runners[]?.name // empty' org_runners.json 2>/dev/null || echo "")

# Fallback to known runner list if API fails
known_runners="xsjevo04"
known_runners="XSJEVO04"

if [ -n "$repo_names" ] || [ -n "$org_names" ]; then
all_names=$(echo -e "$repo_names\n$org_names" | sort -u | tr '\n' ',' | sed 's/,$//')
Expand All @@ -47,10 +47,32 @@ jobs:
- name: Get artifacts
id: artifacts
run: |
curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/actions/artifacts \
> artifacts.json
# Fetch all artifacts with pagination
echo '{"artifacts":[]}' > artifacts.json
page=1
while true; do
response=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts?per_page=100&page=$page")

# Check if request was successful and has artifacts
artifact_count=$(echo "$response" | jq '.artifacts | length')

if [ "$artifact_count" -eq 0 ] || [ "$artifact_count" = "null" ]; then
break
fi

# Merge artifacts into our main file
jq -s '.[0].artifacts + .[1].artifacts | {"artifacts": .}' artifacts.json <(echo "$response") > temp.json
mv temp.json artifacts.json

page=$((page + 1))

# Safety break after 10 pages (1000 artifacts)
if [ $page -gt 10 ]; then
break
fi
done

- name: Check each runner heartbeat
id: check
Expand Down
Loading