Search for skins directory instead of README contetn
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 9s
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 9s
This commit is contained in:
@@ -34,7 +34,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Find Skin Repositories for all users
|
- name: Find Skin Repositories for all users
|
||||||
id: find_skins
|
id: find_skins
|
||||||
shell: sh
|
|
||||||
run: |
|
run: |
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
total_valid_entries=0
|
total_valid_entries=0
|
||||||
@@ -81,32 +80,31 @@ jobs:
|
|||||||
|
|
||||||
echo " → Repo: $owner/$repo"
|
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 }}" \
|
-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 [ "$readme_code" != "200" ]; then
|
||||||
echo " ⛔ Skipped: No README.md (HTTP $http_code)"
|
echo " ❌ Skipped: No README.md found to extract osuid (HTTP $readme_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 "")
|
||||||
|
|
||||||
# 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 }')
|
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 " ❌ Skipped: Missing or invalid osuid"
|
echo " ❌ Skipped: osuid not found in README"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -114,7 +112,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 " ❌ Skipped: osu! API returned no data for $osu_id"
|
echo " ❌ Skipped: osu! API returned no data for osuid $osu_id"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -130,7 +128,7 @@ 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: $username (Rank #$pp_rank) from $owner/$repo"
|
echo " ✅ Match: $username (Rank #$pp_rank) – repo contains Skins/ directory"
|
||||||
total_valid_entries=$((total_valid_entries + 1))
|
total_valid_entries=$((total_valid_entries + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -149,7 +147,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Update README with user skins
|
- name: Update README with user skins
|
||||||
id: update_readme
|
id: update_readme
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user