wth
This commit is contained in:
@@ -33,10 +33,10 @@ jobs:
|
|||||||
token: ${{ secrets.TOKEN }}
|
token: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
- id: fetch-skins-data
|
- id: fetch-skins-data
|
||||||
name: Find Skin Repositories and Generate Tables
|
name: Find Repos Containing /Skins Directory
|
||||||
run: |
|
run: |
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
mkdir -p $ARTIFACT_PATH
|
mkdir -p "$ARTIFACT_PATH"
|
||||||
total_valid_entries=0
|
total_valid_entries=0
|
||||||
|
|
||||||
page=1
|
page=1
|
||||||
@@ -47,62 +47,61 @@ jobs:
|
|||||||
count=$(echo "$users_json" | jq 'length')
|
count=$(echo "$users_json" | jq 'length')
|
||||||
[ "$count" -eq 0 ] && break
|
[ "$count" -eq 0 ] && break
|
||||||
|
|
||||||
|
echo "📄 Found $count users on page $page"
|
||||||
|
|
||||||
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 "🔍 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 continue; fi
|
|
||||||
|
if ! echo "$repos_json" | jq -e . >/dev/null 2>&1; then
|
||||||
|
echo " ⚠️ Could not parse repos for $user_login"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
repos_count=$(echo "$repos_json" | jq 'length')
|
repos_count=$(echo "$repos_json" | jq 'length')
|
||||||
|
echo " 📦 $repos_count repos found"
|
||||||
[ "$repos_count" -eq 0 ] && continue
|
[ "$repos_count" -eq 0 ] && continue
|
||||||
|
|
||||||
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 " → Repo: $owner/$repo"
|
||||||
|
|
||||||
dir_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_dir.json \
|
dir_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o /dev/null \
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
"$GITEA_API/repos/$owner/$repo/contents/Skins?_ts=$(date +%s)")
|
"$GITEA_API/repos/$owner/$repo/contents/Skins?_ts=$(date +%s)")
|
||||||
[ "$dir_code" != "200" ] && continue
|
|
||||||
|
|
||||||
readme_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_readme.json \
|
if [ "$dir_code" = "200" ]; then
|
||||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
echo " ✅ /Skins directory found"
|
||||||
"$GITEA_API/repos/$owner/$repo/contents/README.md?_ts=$(date +%s)")
|
|
||||||
[ "$readme_code" != "200" ] && continue
|
|
||||||
|
|
||||||
content=$(jq -r .content < temp_readme.json | base64 -d || echo "")
|
printf "%07d|<tr><td>%s</td><td>%s</td><td>%s</td><td>-</td><td><a href=\"%s\">Skins</a></td></tr>\n" \
|
||||||
osu_id=$(echo "$content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }')
|
"$((9999999 + total_valid_entries))" "$user_login" "-" "-" "$html_url" >> "$USER_ROWS_FILE"
|
||||||
[ -z "$osu_id" ] && continue
|
|
||||||
|
|
||||||
user_data=$(curl --retry 3 --retry-delay 5 -s \
|
printf "%07d|<a href=\"%s\">🖼️</a>\n" "$((9999999 + total_valid_entries))" "$html_url" >> "$AVATAR_ROWS_FILE"
|
||||||
"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 ] && continue
|
|
||||||
|
|
||||||
pp_rank=$(echo "$user_data" | jq -r '.[0].pp_rank // "9999999"')
|
total_valid_entries=$((total_valid_entries + 1))
|
||||||
pp_country_rank=$(echo "$user_data" | jq -r '.[0].pp_country_rank // "-"')
|
else
|
||||||
username=$(echo "$user_data" | jq -r '.[0].username // "'$owner'"')
|
echo " ❌ Skipped: No /Skins directory (HTTP $dir_code)"
|
||||||
padded_rank=$(printf "%07d" "$pp_rank")
|
fi
|
||||||
|
|
||||||
printf "%s|<tr><td>%s</td><td>%s</td><td>%s</td><td><a href=\"https://osu.ppy.sh/users/%s\">Profile</a></td><td><a href=\"%s\">Skins</a></td></tr>\n" \
|
|
||||||
"$padded_rank" "$username" "$pp_rank" "$pp_country_rank" "$osu_id" "$html_url" >> "$USER_ROWS_FILE"
|
|
||||||
|
|
||||||
timestamp=$(( $(date +%s) / 86400 * 86400 ))
|
|
||||||
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"
|
|
||||||
|
|
||||||
total_valid_entries=$((total_valid_entries + 1))
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
page=$((page + 1))
|
page=$((page + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "✅ Total repos with /Skins: $total_valid_entries"
|
||||||
|
|
||||||
- id: upload-tables
|
- id: upload-tables
|
||||||
name: Upload artifacts
|
name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: skin-tables
|
name: skin-tables
|
||||||
path: /data
|
path: ${{ env.ARTIFACT_PATH }}
|
||||||
|
|
||||||
generate-readme:
|
generate-readme:
|
||||||
needs: gather-skins
|
needs: gather-skins
|
||||||
@@ -118,7 +117,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: skin-tables
|
name: skin-tables
|
||||||
path: /data
|
path: ${{ env.ARTIFACT_PATH }}
|
||||||
|
|
||||||
- id: checkout-code
|
- id: checkout-code
|
||||||
name: Checkout Repository
|
name: Checkout Repository
|
||||||
|
|||||||
Reference in New Issue
Block a user