managarten/.github/workflows/mirror-to-forgejo.yml
Till JS b44bd44666 fix(ci): stash local changes before mirror pull to prevent merge conflicts
The mirror workflow runs git pull on the server's working directory,
which fails if there are uncommitted changes (e.g., from manual edits).
Adding git stash before pull prevents this.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:33:21 +02:00

29 lines
936 B
YAML

# Mirror GitHub → Forgejo on every push to main
# Keeps Forgejo in sync as a backup/visibility mirror.
# GitHub handles CI/CD via native self-hosted runner; Forgejo is mirror-only.
#
# Requires: Mac Mini self-hosted runner with SSH access to Forgejo (localhost:2222)
name: Mirror to Forgejo
on:
push:
branches: [main]
jobs:
mirror:
name: Push to Forgejo
runs-on: self-hosted
steps:
- name: Mirror to Forgejo via SSH
run: |
cd /Users/mana/projects/manacore-monorepo
# Stash any local changes so pull never fails
git stash --quiet 2>/dev/null || true
git pull origin main
# Push to Forgejo via localhost SSH (runner is on the Mac Mini)
GIT_SSH_COMMAND='ssh -p 2222 -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no' \
git push ssh://git@localhost:2222/till/manacore-monorepo.git main 2>&1
echo "Mirrored to Forgejo"