ci: fetch before push, use force-with-lease
This commit is contained in:
parent
a816b8b576
commit
c6fe8547a5
1 changed files with 7 additions and 3 deletions
10
.github/workflows/sync-to-gitea.yml
vendored
10
.github/workflows/sync-to-gitea.yml
vendored
|
|
@ -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!"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue