name: Mirror to GitHub on: push: branches: - main workflow_dispatch: # Allow manual triggering jobs: mirror: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 with: fetch-depth: 0 # Full history for proper mirroring - name: Setup Git run: | git config --global user.name "the-luap" git config --global user.email "paul-nothaft@hotmail.de" - name: Remove sensitive files and directories run: | echo "Current files before cleanup:" ls -la | head -10 || true echo "..." # Remove sensitive files/directories if they exist echo "Removing sensitive files..." rm -rf .gitea/ || true rm -rf scripts/ || true rm -rf .drone* || true rm -rf photo-sharing-prd.md || true rm -rf CLAUDE.md || true rm -rf storage/ || true echo "Sensitive files removal completed" # Add and commit the cleanup if there are changes git add -A if ! git diff --cached --quiet; then git commit -m "chore: remove sensitive files for GitHub mirror" echo "✅ Committed cleanup of sensitive files" else echo "✅ No sensitive files to remove" fi echo "Final file structure (top level):" ls -la | head -10 || true - name: Check GitHub token env: GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }} run: | if [ -z "$GITHUBTOKEN" ]; then echo "ERROR: GITHUBTOKEN secret is not set!" exit 1 else echo "GitHub token is available (length: ${#GITHUBTOKEN})" fi - name: Push to GitHub env: GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }} run: | # Remove existing github remote if it exists git remote remove github || true # Add GitHub remote git remote add github https://x-access-token:${GITHUBTOKEN}@github.com/the-luap/picpeak.git # Verify remote was added echo "GitHub remote added:" git remote -v # Push to GitHub main branch echo "Pushing to GitHub..." git push github main --force echo "✅ Push to GitHub completed!" - name: Workflow completed run: | echo "✅ Mirror to GitHub workflow completed successfully!" echo "📊 Repository mirrored to: https://github.com/the-luap/picpeak" echo "🔒 Sensitive files have been removed from the mirror"