Enhance Organization Mirroring with Improved Reliability and New Options #4

Open
opened 2025-07-08 08:33:04 -04:00 by AtHeartEngineer · 0 comments

Originally created by @arunavo4 on 4/15/2025

Closes:

  1. Bump qs from 6.6.0 to 6.11.0 (#31)
  2. Allow skipping forks (and a dry-run bonus) (#20)

This PR enhances the organization mirroring functionality in mirror-to-gitea with improved reliability and new options. It addresses issues with fetching organizations and repositories, particularly when dealing with organizations that have specific token policies.

Key Changes

  1. Added New Option:

    • ONLY_MIRROR_ORGS: When set to true, only repositories from organizations will be mirrored, skipping personal repositories. This provides better control over what gets mirrored.
  2. Improved Organization Fetching:

    • Added multiple approaches to fetch organizations, with fallbacks if one method fails
    • Added support for handling organizations with token lifetime restrictions
    • Added detailed error messages to help users troubleshoot issues
  3. Enhanced Repository Fetching:

    • Added multiple approaches to fetch repositories from organizations
    • Added fallbacks to different API endpoints if one fails
    • Added checks to verify organization membership and repository access
  4. Better Error Handling:

    • Added specific error messages for common issues, such as token lifetime restrictions
    • Added detailed logging to help diagnose issues
    • Added helpful suggestions for resolving issues
  5. Updated Documentation:

    • Added documentation for the new ONLY_MIRROR_ORGS option
    • Added a section on testing organization mirroring
    • Added information about GitHub token requirements for organization access
  6. Added Testing Script:

    • Added test-org-mirror.sh script for testing organization mirroring specifically

Testing

The changes have been tested with various GitHub organizations, including those with token lifetime restrictions. The code now properly handles these cases and provides helpful error messages to guide users in resolving issues.

To test these changes:

  1. Update your GitHub token if needed (some organizations require tokens with lifetimes less than 366 days)
  2. Run the test-org-mirror.sh script to test organization mirroring specifically
  3. Check that organizations are properly created in Gitea and repositories are mirrored correctly
*Originally created by @arunavo4 on 4/15/2025* Closes: 1. #31 2. #20 This PR enhances the organization mirroring functionality in mirror-to-gitea with improved reliability and new options. It addresses issues with fetching organizations and repositories, particularly when dealing with organizations that have specific token policies. ## Key Changes 1. **Added New Option**: - `ONLY_MIRROR_ORGS`: When set to `true`, only repositories from organizations will be mirrored, skipping personal repositories. This provides better control over what gets mirrored. 2. **Improved Organization Fetching**: - Added multiple approaches to fetch organizations, with fallbacks if one method fails - Added support for handling organizations with token lifetime restrictions - Added detailed error messages to help users troubleshoot issues 3. **Enhanced Repository Fetching**: - Added multiple approaches to fetch repositories from organizations - Added fallbacks to different API endpoints if one fails - Added checks to verify organization membership and repository access 4. **Better Error Handling**: - Added specific error messages for common issues, such as token lifetime restrictions - Added detailed logging to help diagnose issues - Added helpful suggestions for resolving issues 5. **Updated Documentation**: - Added documentation for the new `ONLY_MIRROR_ORGS` option - Added a section on testing organization mirroring - Added information about GitHub token requirements for organization access 6. **Added Testing Script**: - Added `test-org-mirror.sh` script for testing organization mirroring specifically ## Testing The changes have been tested with various GitHub organizations, including those with token lifetime restrictions. The code now properly handles these cases and provides helpful error messages to guide users in resolving issues. To test these changes: 1. Update your GitHub token if needed (some organizations require tokens with lifetimes less than 366 days) 2. Run the `test-org-mirror.sh` script to test organization mirroring specifically 3. Check that organizations are properly created in Gitea and repositories are mirrored correctly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/mirror-to-gitea#4