Skip to content

Conversation

@TooAngel
Copy link
Owner

Summary

Implement backend support for the worlddriven-migrate GitHub App, which handles repository transfers to the worlddriven organization.

This is part of the new migration approach that uses a separate GitHub App (with only administration permission) instead of collaborator invitations, solving the limitation that personal repositories cannot grant admin access to collaborators.

Changes

  • New endpoint: POST /api/webhooks/migrate - webhook handler for the migrate app
  • New file: src/helpers/migrationHandler.js - migration logic
    • findApprovedMigrationPR() - finds approved PRs in documentation repo
    • transferRepository() - calls GitHub transfer API
    • checkPRApprovalStatus() - verifies worlddriven voting approval
    • triggerPRChecks() - re-runs CI after transfer
  • Updated: src/helpers/githubApp.js - added getInstallationAccessToken() for multi-app support
  • Updated: .env-example - documented new environment variables

Migration Flow

User installs worlddriven-migrate app on their repo
              │
              ▼
Webhook triggers, finds approved PR in documentation repo
              │
              ▼
Transfers repository to worlddriven org via API
              │
              ▼
Comments on PR and triggers CI re-run
              │
              ▼
Drift detection passes, PR auto-merges

Environment Variables

New variables needed for the migrate app:

  • MIGRATE_APP_ID - GitHub App ID
  • MIGRATE_APP_PRIVATE_KEY - GitHub App private key

Related

Test Plan

  • All existing tests pass
  • Create worlddriven-migrate GitHub App in org settings
  • Configure environment variables on server
  • Test with migration-test repository

Next Steps

  1. Create the worlddriven-migrate GitHub App manually in GitHub UI
  2. Deploy this code
  3. Test end-to-end with the test repository

Implement the backend support for a separate GitHub App that handles
repository transfers to the worlddriven organization.

Changes:
- Add /api/webhooks/migrate endpoint for the migrate app
- Add migrationHandler.js with transfer logic:
  - findApprovedMigrationPR: checks for approved PRs in documentation repo
  - transferRepository: calls GitHub transfer API
  - triggerPRChecks: re-runs CI after successful transfer
- Add getInstallationAccessToken to githubApp.js for multi-app support
- Update .env-example with migrate app credentials

The migrate app uses a separate minimal permission set (administration
only) to enable transfers without requiring elevated permissions on
the main worlddriven app.

Flow:
1. User installs worlddriven-migrate app on their repo
2. Webhook triggers, checks for approved migration PR
3. If approved, transfers repo to worlddriven org
4. Comments on PR and triggers CI re-run

Relates to worlddriven/documentation#23
@worlddriven
Copy link
Contributor

worlddriven bot commented Dec 26, 2025

🤖 Worlddriven Status

📊 Live Status Dashboard

🗓️ Merge Date: 2025-12-28 at 02:09:09 UTC (in 2 days)
📅 Started: 2025-12-26 at 07:19:05 UTC
Speed Factor: 0.18 (82% faster due to reviews)
Positive votes: 313/381 contribution weight (coefficient: 0.82)
📈 Base Merge Time: 10 days → Current: 2 days

🎯 Want to influence when this merges?

Your review matters! As a contributor to this project, your voice helps determine the merge timeline.

How to review:

  1. Check the changes
    Files changed

  2. Leave your review
    Review changes

Your options:

  • ✅ Agree & Speed Up: Approve Approving makes this merge faster
  • ❌ Disagree & Slow Down: Request changes Requesting changes delays the merge

💡 Pro tip: The more contributors who agree, the faster this gets merged!

📊 View detailed stats on the dashboard

📋 Recent Activity

2025-12-26, 07:19:12 - Pull request opened
2025-12-26, 07:19:13 - Pull request opened


This comment is automatically updated by worlddriven

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.

2 participants