From 3f869a4cd7db2cbc9c943d6e9ac5d0b21fd034c8 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Mon, 6 Apr 2026 19:49:59 +0400 Subject: [PATCH] ci: add GitHub mirror workflow Automatically pushes branches and tags to github.com:manawenuz/wzp.git on every push to Forgejo. Uses GH_SSH_KEY secret for authentication. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/mirror-github.yml | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .gitea/workflows/mirror-github.yml diff --git a/.gitea/workflows/mirror-github.yml b/.gitea/workflows/mirror-github.yml new file mode 100644 index 0000000..df74c2f --- /dev/null +++ b/.gitea/workflows/mirror-github.yml @@ -0,0 +1,43 @@ +name: Mirror to GitHub + +on: + push: + branches: + - main + - 'feat/*' + - 'feature/*' + tags: + - '*' + +jobs: + mirror: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Push to GitHub + env: + GH_SSH_KEY: ${{ secrets.GH_SSH_KEY }} + run: | + mkdir -p ~/.ssh + echo "${GH_SSH_KEY}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null + + git remote add github git@github.com:manawenuz/wzp.git + + # Push the current branch + BRANCH="${GITHUB_REF#refs/heads/}" + TAG="${GITHUB_REF#refs/tags/}" + + if [ "${GITHUB_REF}" != "${GITHUB_REF#refs/tags/}" ]; then + echo "Pushing tag: ${TAG}" + git push github "refs/tags/${TAG}" --force + else + echo "Pushing branch: ${BRANCH}" + git push github "HEAD:refs/heads/${BRANCH}" --force + fi