Update .gitea/workflows/ci.yml

This commit is contained in:
Arlind
2025-06-20 15:55:40 +02:00
parent ad5c61781e
commit 8d9471d01a

View File

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