name: sync-to-gitea on: push: branches: - high-performance jobs: sync: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Preflight token check env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | set -euo pipefail echo "actor=${GITHUB_ACTOR} repo=${GITHUB_REPOSITORY} ref=${GITHUB_REF_NAME}" test -n "${GITEA_TOKEN:-}" || (echo "GITEA_TOKEN is empty" && exit 1) echo "token_len=${#GITEA_TOKEN}" curl -fsS -H "Authorization: token ${GITEA_TOKEN}" https://ci.nxtgauge.com/api/v1/user >/dev/null - name: Sync to Gitea env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} REPO: ${{ github.event.repository.name }} BRANCH: ${{ github.ref_name }} run: | set -euo pipefail test -n "${GITEA_TOKEN:-}" || (echo "GITEA_TOKEN is empty" && exit 1) test -n "${GITEA_USERNAME:-}" || (echo "GITEA_USERNAME is empty" && exit 1) git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" TARGET_URL="https://${GITEA_USERNAME}:${GITEA_TOKEN}@ci.nxtgauge.com/Admin/${REPO}.git" echo "Using Gitea user: ${GITEA_USERNAME}" echo "Sync target: Admin/${REPO}.git" git ls-remote "${TARGET_URL}" >/dev/null git remote remove gitea 2>/dev/null || true git remote add gitea "${TARGET_URL}" git push gitea "HEAD:${BRANCH}" --force git push gitea --tags --force