diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f616c93..9943b98 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: REPO: ${{ github.repository }} REF: ${{ github.ref }} SHA: ${{ github.sha }} - TOKEN: ${{ secrets.GITHUB_TOKEN }} + TOKEN: ${{ gitea.token }} USER_TOKEN: ${{ secrets.token }} run: | git config --global init.defaultBranch main @@ -56,12 +56,13 @@ jobs: cd "$GITHUB_WORKSPACE" git init . - # 优先使用 secrets.GITHUB_TOKEN (TOKEN) + # 优先使用 gitea.token (TOKEN) AUTH_TOKEN="$TOKEN" USE_BASIC_AUTH="false" if [ -n "$TOKEN" ]; then - echo "Using secrets.GITHUB_TOKEN for authentication (Bearer Header)." + echo "Using gitea.token for authentication (Basic Auth)." + USE_BASIC_AUTH="true" elif [ -n "$USER_TOKEN" ]; then AUTH_TOKEN="$USER_TOKEN" USE_BASIC_AUTH="true" @@ -78,7 +79,7 @@ jobs: CLEAN_SERVER=$(echo "$SERVER" | sed -E 's/^\s*.*:\/\///g') git fetch --depth=1 "https://$AUTH_TOKEN:x-oauth-basic@$CLEAN_SERVER/$REPO.git" "$REF" else - # 使用 Bearer Token 进行认证 (GITHUB_TOKEN) + # 使用 Bearer Token 进行认证 git -c http.extraHeader="Authorization: Bearer $AUTH_TOKEN" fetch --depth=1 "$SERVER/$REPO.git" "$REF" fi git checkout FETCH_HEAD