diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index 6a9c6e9..2f8c394 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -33,10 +33,12 @@ jobs:
token: ${{ secrets.TOKEN }}
- id: fetch-skins-data
- name: Find Repos Containing /Skins Directory
+ name: Find Skin Repositories and Generate Tables
run: |
set -eo pipefail
mkdir -p "$ARTIFACT_PATH"
+ : > "$USER_ROWS_FILE"
+ : > "$AVATAR_ROWS_FILE"
total_valid_entries=0
page=1
@@ -64,6 +66,7 @@ jobs:
repos_count=$(echo "$repos_json" | jq 'length')
echo " 📦 $repos_count repos found"
+
[ "$repos_count" -eq 0 ] && continue
for j in $(seq 0 $((repos_count - 1))); do
@@ -72,29 +75,57 @@ jobs:
html_url=$(echo "$repos_json" | jq -r ".[$j].html_url")
echo " → Repo: $owner/$repo"
- dir_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o /dev/null \
+ dir_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_dir.json \
-H "Authorization: token ${{ secrets.TOKEN }}" \
"$GITEA_API/repos/$owner/$repo/contents/Skins?_ts=$(date +%s)")
-
- if [ "$dir_code" = "200" ]; then
- echo " ✅ /Skins directory found"
-
- printf "%07d|
| %s | %s | %s | - | Skins |
\n" \
- "$((9999999 + total_valid_entries))" "$user_login" "-" "-" "$html_url" >> "$USER_ROWS_FILE"
-
- printf "%07d|🖼️\n" "$((9999999 + total_valid_entries))" "$html_url" >> "$AVATAR_ROWS_FILE"
-
- total_valid_entries=$((total_valid_entries + 1))
- else
- echo " ❌ Skipped: No /Skins directory (HTTP $dir_code)"
+ if [ "$dir_code" != "200" ]; then
+ echo " ❌ Skipped: No Skins/ directory (HTTP $dir_code)"
+ continue
fi
+
+ readme_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_readme.json \
+ -H "Authorization: token ${{ secrets.TOKEN }}" \
+ "$GITEA_API/repos/$owner/$repo/contents/README.md?_ts=$(date +%s)")
+ if [ "$readme_code" != "200" ]; then
+ echo " ❌ Skipped: No README.md (HTTP $readme_code)"
+ continue
+ fi
+
+ content=$(jq -r .content < temp_readme.json | base64 -d || echo "")
+ osu_id=$(echo "$content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }')
+ if [ -z "$osu_id" ]; then
+ echo " ❌ Skipped: No osuid in README"
+ continue
+ fi
+
+ user_data=$(curl --retry 3 --retry-delay 5 -s \
+ "https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id&_ts=$(date +%s)")
+ [ "$(echo "$user_data" | jq 'length')" -eq 0 ] && {
+ echo " ❌ Skipped: No data from osu! API"
+ continue
+ }
+
+ pp_rank=$(echo "$user_data" | jq -r '.[0].pp_rank // "9999999"')
+ pp_country_rank=$(echo "$user_data" | jq -r '.[0].pp_country_rank // "-"')
+ username=$(echo "$user_data" | jq -r '.[0].username // "'$owner'"')
+ padded_rank=$(printf "%07d" "$pp_rank")
+
+ printf "%s|| %s | %s | %s | Profile | Skins |
\n" \
+ "$padded_rank" "$username" "$pp_rank" "$pp_country_rank" "$osu_id" "$html_url" >> "$USER_ROWS_FILE"
+
+ timestamp=$(( $(date +%s) / 86400 * 86400 ))
+ printf "%s|
\n" \
+ "$padded_rank" "$html_url" "$osu_id" "$timestamp" >> "$AVATAR_ROWS_FILE"
+
+ echo " ✅ Added: $username (#$pp_rank)"
+ total_valid_entries=$((total_valid_entries + 1))
done
done
page=$((page + 1))
done
echo
- echo "✅ Total repos with /Skins: $total_valid_entries"
+ echo "✅ Total valid entries found: $total_valid_entries"
- id: upload-tables
name: Upload artifacts