GEI Migration Helper

GitHub CLI Extension.

This is a wrapper tool to GitHub Enterprise Importer that orchestrate necessary steps between GitHub's GEI repository migration and GHAS secret and code scanning migrations.

It is a collection of scripts that can be used to help with the migration process by wrapping GEI commands and performing pre and post-migration changes

Installation

the GEI Migration Helper can be installed via this command:

$ gh extension install gateixeira/gh-gei-migration-helper

Usage

Run the tool via command line:

$ gh gei-migration-helper --help

Migration process

Read all repositories from source organization and for each repository:

  1. Deactivate GitHub Advanced Security features at source repository if enabled
  2. Disable workflows at source repository, if any
  3. Migrate repository to target organization
  4. Delete branch protections at target (To be removed in a later version)
  5. If repository is internal at source it should be reset to internal at target after migration
  6. Activate GitHub Advanced Security at target
  7. Reactivate GitHub Advanced Security at source
  8. Migrate code scanning alerts
  9. Re-enable workflows at source, if any
  10. Archive source repository

Manual steps to execute a migration

  1. Download the GitHub CLI
  2. Install the GEI extension
  3. Create a personal access token for the source and target organization according to these scopes
  4. Run the migration helper scripts
  5. migrate-organization to migrate all repositories in an organization
  6. Wait for secret scanning to execute on the target organization
  7. migrate-secret-scanning to migrate secret scanning results
  8. reactivate-target-workflow to reactivate workflows at target that were deactivated during the migration process

Scripts

migrate-organization

This script can be used to migrate all repositories in an organization

Usage

$ gh gh-gei-migration-helper migrate-organization --source-org <source_org> --target-org <target_org> --source-token <source_token> --target-token <target_token>

migrate-repository

This script can be used to migrate a single repository

Usage

$ gh gh-gei-migration-helper migrate-repository --repo <repository_name> --source-org <source_org> --target-org <target_org> --source-token <source_token> --target-token <target_token>

migrate-secret-scanning

Wrapper to migrate secret scan results. It migrates for all repositories in an org if no --repo is provided.

Usage

$ gh gh-gei-migration-helper migrate-secret-scanning --repo <repository_name> --source-org <source_org> --target-org <target_org> --source-token <source_token> --target-token <target_token>

reactivate-target-workflow

Resets the target repository workflows to their original state. It reactivates all workflows that were deactivated during the migration process.

Omit the repository flag to run against the whole organization.

Usage

$ gh gh-gei-migration-helper reactivate-target-workflow --source-org <source_org> --target-org <target_org> --source-token <source_token> --target-token <target_token>