diff --git a/.gitea/workflows/releases.yml b/.gitea/workflows/releases.yml index 32369e3..647909d 100644 --- a/.gitea/workflows/releases.yml +++ b/.gitea/workflows/releases.yml @@ -20,11 +20,12 @@ jobs: env: GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + git config --global init.defaultBranch main git config --global --add safe.directory "$GITHUB_WORKSPACE" - SERVER_HOST=$(echo "${{ github.server_url }}" | sed -e 's|^https://||' -e 's|^http://||') + CLONE_URL=$(echo "${{ github.server_url }}" | sed -E "s|^(https?://)|\1${GITEA_TOKEN}@|")/${{ github.repository }}.git git init - git remote add origin "https://${GITEA_TOKEN}@${SERVER_HOST}/${{ github.repository }}.git" || \ - git remote set-url origin "https://${GITEA_TOKEN}@${SERVER_HOST}/${{ github.repository }}.git" + git remote add origin "$CLONE_URL" || git remote set-url origin "$CLONE_URL" + git config http.extraheader "AUTHORIZATION: token ${GITEA_TOKEN}" git fetch --depth 1 origin "${{ github.sha }}" || git fetch --depth 1 origin main git checkout -f FETCH_HEAD