Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 10, 2025

🎯 Summary

This PR implements automatic repository mirroring to GitLab and Bitbucket as requested in issue #82. The solution provides:

  • Automatic mirroring of all branches and tags to both platforms
  • Safe branch deletion that only replicates deletions if branches were fully merged
  • Complete backup solution maintaining full repository history
  • Multi-platform accessibility making the project easily accessible from multiple places

📋 Issue Reference

Fixes #82

🚀 Implementation Details

Core Features

  1. Comprehensive Mirroring Workflow (.github/workflows/mirror-repositories.yml)

    • Mirrors all push events to both GitLab and Bitbucket
    • Handles branch and tag synchronization
    • Implements safe branch deletion with merge verification
    • Includes error handling and fallback mechanisms
  2. Setup Documentation (MIRRORING_SETUP.md)

    • Complete configuration guide
    • Security considerations and best practices
    • Troubleshooting instructions
    • Manual sync procedures for emergencies

Safety Features

  • Merge Verification: Branch deletions only replicated if fully merged into main branch
  • Error Handling: Graceful fallbacks if mirror operations fail
  • Secure Authentication: Uses encrypted GitHub secrets for credentials
  • Isolation: Separate jobs for each platform prevent cross-contamination

Workflow Triggers

  • push: Mirrors all branch and tag pushes
  • delete: Handles branch deletions with merge safety checks
  • Separate job for tag mirroring with dedicated handling

🔧 Setup Requirements

The following GitHub secrets need to be configured:

GitLab

  • GITLAB_TOKEN: Personal Access Token with api, read_repository, write_repository scopes
  • GITLAB_PROJECT_PATH: Target project path (e.g., linksplatform/interfaces)

Bitbucket

  • BITBUCKET_USERNAME: Your Bitbucket username
  • BITBUCKET_APP_PASSWORD: App password with Repositories: Write permission
  • BITBUCKET_PROJECT_PATH: Target repository path (e.g., linksplatform/interfaces)

🧪 Testing

  • ✅ YAML syntax validation passed
  • ✅ Workflow structure verified
  • ✅ Error handling paths tested
  • ✅ Security review completed
  • ✅ Documentation comprehensiveness checked

📚 Files Changed

  • .github/workflows/mirror-repositories.yml - Main mirroring workflow
  • MIRRORING_SETUP.md - Comprehensive setup and usage documentation

🔒 Security Considerations

  • All credentials stored as encrypted GitHub secrets
  • HTTPS-only authentication
  • Minimal permission requirements
  • No secret exposure in logs
  • Safe branch deletion prevents accidental data loss

This solution provides a robust, secure, and maintainable mirroring system that meets all requirements specified in issue #82.

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #82
@konard konard self-assigned this Sep 10, 2025
konard and others added 2 commits September 10, 2025 18:32
- Implement comprehensive GitHub Actions workflow for repository mirroring
- Add safe branch deletion handling (only if fully merged)
- Include detailed setup documentation with security considerations
- Support for both GitLab and Bitbucket with error handling
- Maintain complete repository history across all mirrors

Fixes #82

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Setup automatic mirroring to GitLab and Bitbucket Setup automatic mirroring to GitLab and Bitbucket Sep 10, 2025
@konard konard marked this pull request as ready for review September 10, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup automatic mirroring to GitLab and Bitbucket

2 participants