From c6fe8547a500d9e077728b98304d5ce3e6143215 Mon Sep 17 00:00:00 2001 From: Tracewebstudio Dev Date: Sun, 19 Apr 2026 16:00:12 +0200 Subject: [PATCH] ci: fetch before push, use force-with-lease --- .github/workflows/sync-to-gitea.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-to-gitea.yml b/.github/workflows/sync-to-gitea.yml index 341a21e..05d74d7 100644 --- a/.github/workflows/sync-to-gitea.yml +++ b/.github/workflows/sync-to-gitea.yml @@ -18,12 +18,16 @@ jobs: - name: Push to Gitea main env: + GITEA_USERNAME: Admin GITEA_TOKEN: ${{ secrets.GITEA_SECRET }} run: | - echo "Syncing nxtgauge-ai-assistant:main → Gitea main" + set -euo pipefail + echo "Syncing ${{ github.event.repository.name }}:main → Gitea main" echo "Commit: $(git rev-parse HEAD)" - git remote add gitea "https://Admin:${GITEA_TOKEN}@ci.nxtgauge.com/Admin/nxtgauge-ai-assistant.git" - git push gitea main:main --force-with-lease + git remote add gitea "https://${GITEA_USERNAME}:${GITEA_TOKEN}@ci.nxtgauge.com/Admin/${{ github.event.repository.name }}.git" + + git fetch gitea main || true + git push gitea HEAD:main --force-with-lease=refs/heads/main echo "Sync complete!"