diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 20ab714..26c46d1 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -74,17 +74,12 @@ jobs: echo " Checking repo: $repo" >&2 - curl_output=$(curl --fail --retry 3 --retry-delay 5 -s -w "%{http_code}" -o readme_content.json \ + curl -sSL -w "%{http_code}" -o readme_content.json \ -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)" > http_code.txt - curl_exit=$? - http_code="$curl_output" - - if [ $curl_exit -ne 0 ]; then - echo "Failed to fetch README for $owner/$repo (HTTP $http_code)" >&2 - continue - fi + http_code=$(cat http_code.txt) + rm -f http_code.txt if [ "$http_code" != "200" ]; then echo "README not found for $owner/$repo (HTTP $http_code)" >&2 @@ -95,11 +90,12 @@ jobs: rm -f readme_content.json if echo "$readme_content" | grep -qE "^---$" && \ - echo "$readme_content" | grep -qE "^gitea: none" && \ - echo "$readme_content" | grep -qE "^include_toc: true" && \ - echo "$readme_content" | grep -qE "^# Skins"; then + echo "$readme_content" | grep -qE "^gitea: none" && \ + echo "$readme_content" | grep -qE "^include_toc: true" && \ + echo "$readme_content" | grep -qE "^# Skins"; then osu_id=$(echo "$readme_content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }') + if [ -n "$osu_id" ]; then user_data=$(curl --fail --retry 3 --retry-delay 5 -s \ "https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id&_ts=$(date +%s)") @@ -125,6 +121,7 @@ jobs: else echo "osu! ID not found in README for $owner/$repo" >&2 fi + else echo "README for $owner/$repo does not match required format" >&2 fi