Improve logging
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 6s
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 6s
This commit is contained in:
@@ -43,60 +43,70 @@ jobs:
|
|||||||
|
|
||||||
page=1
|
page=1
|
||||||
while :; do
|
while :; do
|
||||||
echo "::group::Fetching users (page $page)"
|
|
||||||
users_json=$(curl --retry 3 --retry-delay 5 -sSL \
|
users_json=$(curl --retry 3 --retry-delay 5 -sSL \
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
"$GITEA_API/admin/users?limit=50&page=$page&_ts=$(date +%s)")
|
"$GITEA_API/admin/users?limit=50&page=$page&_ts=$(date +%s)")
|
||||||
count=$(echo "$users_json" | jq 'length')
|
count=$(echo "$users_json" | jq 'length')
|
||||||
[ "$count" -eq 0 ] && break
|
[ "$count" -eq 0 ] && break
|
||||||
echo "➤ Found $count users"
|
|
||||||
echo "::endgroup::"
|
echo "Found $count users on page $page"
|
||||||
|
echo
|
||||||
|
|
||||||
for i in $(seq 0 $((count - 1))); do
|
for i in $(seq 0 $((count - 1))); do
|
||||||
user_login=$(echo "$users_json" | jq -r ".[$i].login")
|
user_login=$(echo "$users_json" | jq -r ".[$i].login")
|
||||||
echo "::group::🔍 Checking user: $user_login"
|
echo "🔍 User: $user_login"
|
||||||
|
|
||||||
repos_json=$(curl --retry 3 --retry-delay 5 -sSL \
|
repos_json=$(curl --retry 3 --retry-delay 5 -sSL \
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
"$GITEA_API/users/$user_login/repos?_ts=$(date +%s)")
|
"$GITEA_API/users/$user_login/repos?_ts=$(date +%s)")
|
||||||
|
|
||||||
if ! echo "$repos_json" | jq -e . >/dev/null 2>&1; then
|
if ! echo "$repos_json" | jq -e . >/dev/null 2>&1; then
|
||||||
echo "⚠️ Failed to parse repos for $user_login, skipping"
|
echo " ⚠️ Could not parse repos for $user_login"
|
||||||
echo "::endgroup::"
|
echo
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
repos_count=$(echo "$repos_json" | jq 'length')
|
repos_count=$(echo "$repos_json" | jq 'length')
|
||||||
echo "📦 Found $repos_count repositories"
|
echo " 📦 Found $repos_count repos"
|
||||||
|
|
||||||
[ "$repos_count" -eq 0 ] && echo "::endgroup::" && continue
|
if [ "$repos_count" -eq 0 ]; then
|
||||||
|
echo
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
for j in $(seq 0 $((repos_count - 1))); do
|
for j in $(seq 0 $((repos_count - 1))); do
|
||||||
owner=$(echo "$repos_json" | jq -r ".[$j].owner.login")
|
owner=$(echo "$repos_json" | jq -r ".[$j].owner.login")
|
||||||
repo=$(echo "$repos_json" | jq -r ".[$j].name")
|
repo=$(echo "$repos_json" | jq -r ".[$j].name")
|
||||||
html_url=$(echo "$repos_json" | jq -r ".[$j].html_url")
|
html_url=$(echo "$repos_json" | jq -r ".[$j].html_url")
|
||||||
|
|
||||||
echo "→ Checking repo: $owner/$repo"
|
echo " → Repo: $owner/$repo"
|
||||||
|
|
||||||
http_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_readme.json \
|
http_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_readme.json \
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
"$GITEA_API/repos/$owner/$repo/contents/README.md?_ts=$(date +%s)")
|
"$GITEA_API/repos/$owner/$repo/contents/README.md?_ts=$(date +%s)")
|
||||||
|
|
||||||
if [ "$http_code" != "200" ]; then
|
if [ "$http_code" != "200" ]; then
|
||||||
echo "⛔ No README.md found (HTTP $http_code)"
|
echo " ⛔ Skipped: No README.md (HTTP $http_code)"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
content=$(jq -r .content < temp_readme.json | base64 -d || echo "")
|
content=$(jq -r .content < temp_readme.json | base64 -d || echo "")
|
||||||
|
|
||||||
if ! echo "$content" | grep -q "^---$"; then echo "❌ Missing frontmatter"; continue; fi
|
# Check for required README parts
|
||||||
if ! echo "$content" | grep -q "^gitea: none"; then echo "❌ Missing 'gitea: none'"; continue; fi
|
skip_reason=""
|
||||||
if ! echo "$content" | grep -q "^include_toc: true"; then echo "❌ Missing 'include_toc: true'"; continue; fi
|
echo "$content" | grep -q "^---$" || skip_reason="Missing frontmatter"
|
||||||
if ! echo "$content" | grep -q "^# Skins"; then echo "❌ Missing '# Skins' header"; continue; fi
|
echo "$content" | grep -q "^gitea: none" || skip_reason="Missing 'gitea: none'"
|
||||||
|
echo "$content" | grep -q "^include_toc: true" || skip_reason="Missing 'include_toc: true'"
|
||||||
|
echo "$content" | grep -q "^# Skins" || skip_reason="Missing '# Skins'"
|
||||||
|
|
||||||
|
if [ -n "$skip_reason" ]; then
|
||||||
|
echo " ❌ Skipped: $skip_reason"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
osu_id=$(echo "$content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }')
|
osu_id=$(echo "$content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }')
|
||||||
if [ -z "$osu_id" ]; then
|
if [ -z "$osu_id" ]; then
|
||||||
echo "❌ Missing or invalid osuid"
|
echo " ❌ Skipped: Missing or invalid osuid"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -104,7 +114,7 @@ jobs:
|
|||||||
"https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id&_ts=$(date +%s)")
|
"https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id&_ts=$(date +%s)")
|
||||||
|
|
||||||
if [ "$(echo "$user_data" | jq 'length')" -eq 0 ]; then
|
if [ "$(echo "$user_data" | jq 'length')" -eq 0 ]; then
|
||||||
echo "❌ osu! API returned no data for osuid $osu_id"
|
echo " ❌ Skipped: osu! API returned no data for $osu_id"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -120,11 +130,11 @@ jobs:
|
|||||||
printf "%s|<a href=\"%s\"><img src=\"https://a.ppy.sh/%s?%s\" width=175 height=175></a>\n" \
|
printf "%s|<a href=\"%s\"><img src=\"https://a.ppy.sh/%s?%s\" width=175 height=175></a>\n" \
|
||||||
"$padded_rank" "$html_url" "$osu_id" "$timestamp" >> "$avatar_rows_file"
|
"$padded_rank" "$html_url" "$osu_id" "$timestamp" >> "$avatar_rows_file"
|
||||||
|
|
||||||
echo "✅ Match: $owner/$repo with osu! user $username (Rank #$pp_rank)"
|
echo " ✅ Match: $username (Rank #$pp_rank) from $owner/$repo"
|
||||||
total_valid_entries=$((total_valid_entries + 1))
|
total_valid_entries=$((total_valid_entries + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo
|
||||||
done
|
done
|
||||||
|
|
||||||
page=$((page + 1))
|
page=$((page + 1))
|
||||||
@@ -133,7 +143,9 @@ jobs:
|
|||||||
echo "user_rows_file=$user_rows_file" >> "$GITHUB_OUTPUT"
|
echo "user_rows_file=$user_rows_file" >> "$GITHUB_OUTPUT"
|
||||||
echo "avatar_rows_file=$avatar_rows_file" >> "$GITHUB_OUTPUT"
|
echo "avatar_rows_file=$avatar_rows_file" >> "$GITHUB_OUTPUT"
|
||||||
echo "total_valid_entries=$total_valid_entries" >> "$GITHUB_OUTPUT"
|
echo "total_valid_entries=$total_valid_entries" >> "$GITHUB_OUTPUT"
|
||||||
echo "✔️ Total valid skin repos: $total_valid_entries"
|
|
||||||
|
echo
|
||||||
|
echo "✅ Total valid skin entries found: $total_valid_entries"
|
||||||
|
|
||||||
- name: Update README with user skins
|
- name: Update README with user skins
|
||||||
id: update_readme
|
id: update_readme
|
||||||
|
|||||||
Reference in New Issue
Block a user