From 770d9342baf383b982d458e78495fd07a6cb5669 Mon Sep 17 00:00:00 2001 From: Arlind Date: Mon, 16 Jun 2025 12:34:42 +0200 Subject: [PATCH] fix cache issues? --- .gitea/workflows/ci.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2934aa1..599fa2c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: runs-on: ubuntu-latest container: image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest + options: --pull always steps: - name: Checkout Repository @@ -32,7 +33,11 @@ jobs: avatar_rows_file=$(mktemp) echo "Fetching users page 1..." >&2 - users_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/admin/users?limit=50&page=1") + users_json=$(curl -sSL \ + -H "Authorization: token ${{ secrets.TOKEN }}" \ + -H "Cache-Control: no-cache" \ + -H "Pragma: no-cache" \ + "$GITEA_API/admin/users?limit=50&page=1&_ts=$(date +%s)") jq_type=$(echo "$users_json" | jq -r 'type' 2>/dev/null || echo "jq_error_type") jq_length=$(echo "$users_json" | jq 'length' 2>/dev/null || echo "jq_error_length") @@ -46,7 +51,12 @@ jobs: user_login=$(echo "$users_json" | jq -r ".[$i].login") echo "Processing user: $user_login" >&2 - repos_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/users/$user_login/repos") + repos_json=$(curl -sSL \ + -H "Authorization: token ${{ secrets.TOKEN }}" \ + -H "Cache-Control: no-cache" \ + -H "Pragma: no-cache" \ + "$GITEA_API/users/$user_login/repos?_ts=$(date +%s)") + repos_type=$(echo "$repos_json" | jq -r 'type' 2>/dev/null || echo "not_array") repos_count=$(echo "$repos_json" | jq 'length' 2>/dev/null || echo "0") if [ "$repos_type" != "array" ] || [ "$repos_count" -eq 0 ]; then @@ -62,7 +72,11 @@ jobs: html_url=$(echo "$repos_json" | jq -r ".[$j].html_url") echo " Checking repo: $repo" >&2 - readme_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/repos/$owner/$repo/contents/README.md" || echo "{}") + readme_json=$(curl -sSL \ + -H "Authorization: token ${{ secrets.TOKEN }}" \ + -H "Cache-Control: no-cache" \ + -H "Pragma: no-cache" \ + "$GITEA_API/repos/$owner/$repo/contents/README.md?_ts=$(date +%s)" || echo "{}") if echo "$readme_json" | jq -e '.content' >/dev/null 2>&1; then content=$(echo "$readme_json" | jq -r .content | base64 -d || echo "") @@ -74,7 +88,11 @@ jobs: if [ $? -eq 0 ]; then osu_id=$(echo "$content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }') if [ -n "$osu_id" ]; then - user_data=$(curl -s -H 'Cache-Control: no-cache' -H 'Pragma: no-cache' --compressed "https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id") + user_data=$(curl -s \ + -H 'Cache-Control: no-cache' \ + -H 'Pragma: no-cache' \ + --compressed "https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id&_ts=$(date +%s)") + pp_rank=$(echo "$user_data" | jq -r '.[0].pp_rank // "9999999"') pp_country_rank=$(echo "$user_data" | jq -r '.[0].pp_country_rank // "-"') username=$(echo "$user_data" | jq -r '.[0].username // "'$owner'"')