From 67c0624079dfdd7cc0993929863228dd78fdc423 Mon Sep 17 00:00:00 2001 From: JonaKl Date: Mon, 23 Mar 2026 14:42:45 +0100 Subject: [PATCH] add github sync flow --- .gitea/workflows/github-sync.yaml | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitea/workflows/github-sync.yaml diff --git a/.gitea/workflows/github-sync.yaml b/.gitea/workflows/github-sync.yaml new file mode 100644 index 0000000..b4f00bd --- /dev/null +++ b/.gitea/workflows/github-sync.yaml @@ -0,0 +1,39 @@ +name: Mirror to GitHub + +on: + push: + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Configure git + run: | + git config user.name "gitea-mirror" + git config user.email "mirror@example.com" + + - name: Add GitHub remote + env: + MIRROR_REPO: ${{ vars.MIRROR_REPO }} + MIRROR_TOKEN: ${{ secrets.MIRROR_TOKEN }} + run: | + if [ -z "$MIRROR_REPO" ] || [ -z "$MIRROR_TOKEN" ]; then + echo "Missing required secrets: MIRROR_REPO and/or MIRROR_TOKEN" + exit 1 + fi + git remote add github "https://x-access-token:${MIRROR_TOKEN}@github.com/${MIRROR_REPO}.git" || \ + git remote set-url github "https://x-access-token:${MIRROR_TOKEN}@github.com/${MIRROR_REPO}.git" + + - name: Push branches + run: | + git for-each-ref --format='%(refname:short)' refs/heads | while read branch; do + git push --force --prune github "refs/heads/$branch:refs/heads/$branch" || exit 1 + done + + - name: Push tags + run: git push --tags github --force +