name: Mirror to GitHub (Rsync Method) on: push: branches: - main jobs: mirror: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 with: fetch-depth: 0 - name: Prepare mirror directory run: | # Create mirror directory mkdir -p /tmp/github-mirror # Use rsync to copy files, excluding sensitive ones rsync -av --exclude-from='.github-mirror-exclude' ./ /tmp/github-mirror/ - name: Push to GitHub env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd /tmp/github-mirror # Initialize git repo git init git config user.name "Gitea Mirror Bot" git config user.email "bot@noreply.gitea.local" # Add all files and commit git add . git commit -m "Mirror from Gitea: $(git --git-dir=$GITHUB_WORKSPACE/.git log -1 --format='%h %s')" # Push to GitHub git remote add origin https://x-access-token:${GITHUB_TOKEN}@github.com/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME.git git push -f origin main