Files
Subscribarr/.gitea/workflows/github_mirror.yaml
jschaufuss 10602f5929
Some checks failed
Mirror main to GitHub (shallow) / mirror (push) Failing after 0s
update action
2025-08-16 13:49:22 +02:00

40 lines
1.2 KiB
YAML

name: Mirror main to GitHub (shallow)
on:
push:
branches: ["main"] # nur main triggern
workflow_dispatch: # manuell startbar
concurrency:
group: mirror-main-to-github
cancel-in-progress: false
jobs:
mirror:
runs-on: main
steps:
- name: Init repo
run: |
git init
git remote add origin "${GT_SERVER_URL}/${GT_REPO}.git"
git fetch --depth=1 origin main
git checkout -b main FETCH_HEAD
- name: Add GitHub remote
env:
GH_USER: ${{ secrets.GH_USER }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_OWNER: ${{ secrets.GH_OWNER }}
GH_REPO: ${{ secrets.GH_REPO }}
run: |
set -euo pipefail
: "${GH_USER?missing}"; : "${GH_TOKEN?missing}"; : "${GH_OWNER?missing}"; : "${GH_REPO?missing}"
git remote remove mirror 2>/dev/null || true
git remote add mirror "https://${GH_USER}:${GH_TOKEN}@github.com/${GH_OWNER}/${GH_REPO}.git"
- name: Push main branch (shallow)
run: |
# force ist i. d. R. nicht nötig; nur, wenn du auf GitHub main überschreiben willst
git push mirror HEAD:refs/heads/main