package
0.26.0
Repository: https://github.com/harness/harness-migrate.git
Documentation: pkg.go.dev

# README

Git migrator for Github

We support migrating these entities from Github:

  • Repository
  • Repository Public/Private status
  • Pull requests
  • Pull request comments
  • Pull request review comments
  • Labels
  • Webhooks
  • Branch Rules

Items that would not imported or imported differently:

  • Task lists: Task lists are imported as normal comments
  • Emoji reactions
  • Pull request reviewers and approvers
  • Any attachment
  • LFS objects
  • Webhooks: Some webhook events are not supported. You can check supported triggers here

Estimating export duration

Export will depend on the size of repo and its pull request. A repo which has more pull request but less comments will take more time than one which has more comments and lesser pull requests.

Prerequisites

To export projects from Github, you must have admin write access in for the project to successfully export all the supported entities.

Users

All the users encountered anywhere are stored by email and can be found in users.json in the exported zip file.

Installing

You can install the migrator via github releases or run make build with latest go version present in your system.

Branch Protection and Webhooks

When they are exported, supported Github branch protection rules and webhooks are stored in zip file, which later during import to harness code are mapped according to:

Webhooks

Github eventsHarness Code events
Branch or tag creationBranch Created, Tag Created
Branch or tag deletionBranch Deleted, Tag Deleted
Pull requestsPR created, PR updated, PR closed, PR reopened, PR merged
Pull request review comments, Commit commentsPR comment created
PushesBranch updated, Tag updated, PR branch updated

Branch protection rules

Github rule(set)Harness Code rule
Restrict creationsBlock branch creation
Restrict deletionsBlock branch deletion
Restrict updatesBlock branch update
Require linear historyRequire pull request
Require a pull request before mergingRequire pull request
Dismiss stale pull request approvals when new commits are pushedRequire approval of new changes
Require approval of the most recent reviewable pushRequire approval of new changes
Require review from Code OwnersRequire review from code owners
Require conversation resolution before mergingRequire comment resolution
Block force pushesBlock force push

Commands

As a quick start you can run

./migrator github git-export --project <project name> --repository <repo-name> --host <host-url> --username <github-username> --token <token> <zip-folder-path> 

where you have to replace all values enclosed in brackets <>.

You can also provide more advanced options. You can look at those via help:

./migrator github git-export --help

Application also supports advanced option like resume which can help you resume run from last successful run and avoid overhead of re-running the same commands.

Troubleshooting

General

Export fails due to reach the Github rate limit

If project export fails due to reaching the Github API rate limit, you could wait for an hour and re-run the migrator or exclude exporting metadata (options available are --no-pr, --no-comment, --no-webhook, and --no-rule)

Export fails due to missing permission

If you see errors in listing webhooks, make sure the provided token has admin permission.

Missing webhooks or branch rules

If you see missing items for any webhooks or branch rules you can refer ExporterLogs.log file in root of zip folder.

Webhooks don't have all the events

As of now all webhook events are not supported and you can check ExporterLogs.log file to get error logs.

# Functions

No description provided by the author