0.0
No commit activity in last 3 years
No release in over 3 years
Migrate Pull requests from one repo to other
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.4

Runtime

~> 4.2
~> 1.6
 Project Readme

PR migrator

Pull requests Migrator. This is a little utility which helps in 2 ways

  • Exporting Github PR's into JSON files .
  • Creating PR's into another repo from the Export.

During the Github Migration we loose the PR content. This would help us to still get few things (Not all) and still keep things searchable.

Installation

Add the gem to the Gemfile:

gem "pr_migrator"    

bundle install

Getting Started

Setup the config

PrMigrator.configure do |config|
  config.source_access_token = 'xxxxx'
  config.destination_access_token = 'xxxxxx'
  config.github_enterprise_endpoint = 'https://your_org.github.com'
end

In the above configs

source_access_token: Is the acccess token of the Github account from where the Export is being made. destination_access_token: Is the access token of the other Github Account (May be Enterprise). If it's on github.com use the same as source_access_token github_enterprise_endpoint: This will be required when Migrating to Github enterprise.

Exporting PR's

export_instance = PrMigrator::Export.new(repo_name: YOUR_REPO_NAME, pr_numbers: ARRAY_OF_PR_NUMBERS)
create_instance.start # Starts the export 

# Example
# PrMigrator::Export.new(repo_name: 'ankit8898/foo', pr_numbers: [1,2,3,4,5,6]) #array of PR's
# PrMigrator::Export.new(repo_name: 'ankit8898/foo', pr_numbers: (3..4).to_a) # Range of PR

After the export is run the files will we present in a export_xxx folder.

Creating PR's

Creating of PR's is not straight. 😐

The creation module Simulates the creation of PR as you would create manually. But it Updates the content of the PR with the ones from the exports. To get started

NOTE: You have to create a Branch in the Repo where the PR's are getting migrated. We will Call this branch as migrated

# Create an Instance of Create
create_instance = PrMigrator::Create.new(repo_name: 'agupta/new_foo', exported_pr_dir: 'PATH_TO_FILES/*',migration_branch: 'migrated')

create_instance.start # Starts the creation