From 6bbc4f7ca8ae6929ea196b7db34955403b670e66 Mon Sep 17 00:00:00 2001 From: Arlind-dev Date: Fri, 20 Jun 2025 16:42:14 +0200 Subject: [PATCH] Search for skins directory instead of README contetn --- .gitea/workflows/ci.yml | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 36de39f..ba966dc 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -34,7 +34,6 @@ jobs: - name: Find Skin Repositories for all users id: find_skins - shell: sh run: | set -eo pipefail total_valid_entries=0 @@ -81,32 +80,31 @@ jobs: echo " → Repo: $owner/$repo" - http_code=$(curl --retry 3 --retry-delay 5 -s -w "%{http_code}" -o temp_readme.json \ + # Check for Skins directory + 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 " ❌ Skipped: No 'Skins/' directory found (HTTP $dir_code)" + continue + fi + + # Check for README to extract osuid + 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 [ "$http_code" != "200" ]; then - echo " ⛔ Skipped: No README.md (HTTP $http_code)" + if [ "$readme_code" != "200" ]; then + echo " ❌ Skipped: No README.md found to extract osuid (HTTP $readme_code)" continue fi content=$(jq -r .content < temp_readme.json | base64 -d || echo "") - - # Check for required README parts - skip_reason="" - echo "$content" | grep -q "^---$" || skip_reason="Missing frontmatter" - 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 }') + if [ -z "$osu_id" ]; then - echo " ❌ Skipped: Missing or invalid osuid" + echo " ❌ Skipped: osuid not found in README" continue fi @@ -114,7 +112,7 @@ jobs: "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 - echo " ❌ Skipped: osu! API returned no data for $osu_id" + echo " ❌ Skipped: osu! API returned no data for osuid $osu_id" continue fi @@ -130,7 +128,7 @@ jobs: printf "%s|\n" \ "$padded_rank" "$html_url" "$osu_id" "$timestamp" >> "$avatar_rows_file" - echo " ✅ Match: $username (Rank #$pp_rank) from $owner/$repo" + echo " ✅ Match: $username (Rank #$pp_rank) – repo contains Skins/ directory" total_valid_entries=$((total_valid_entries + 1)) done @@ -149,7 +147,6 @@ jobs: - name: Update README with user skins id: update_readme - shell: bash run: | set -eo pipefail