Skip to content

GH CLI extension to assist in the migration of releases between GitHub repositories

License

Notifications You must be signed in to change notification settings

mona-actions/gh-migrate-releases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-migrate-releases

gh-migrate-releases is a GitHub CLI extension to assist in the migration of releases between GitHub repositories. This extension aims to fill the gaps in the existing solutions for migrating releases. Whether you are consolidating repositories in an organization or auditing releases in an existing repository, this extension can help.

Install

gh extension install mona-actions/gh-migrate-releases

Upgrade

gh extension upgrade gh-migrate-releases

Usage: Export

Creates a JSON file of the releases tied to a repository

gh migrate-releases export --hostname github.example.com -o <org-name> --repository <repo-name> --token <token>
Usage:
  migrate-releases export [flags]

Flags:
  -f, --file-prefix string    Output filenames prefix
  -h, --help                  help for export
  -u, --hostname string       GitHub Enterprise hostname url (optional) Ex. github.example.com
  -o, --organization string   Organization of the repository
  -r, --repository string     repository to export
  -t, --token string          GitHub token

Usage: Sync

Recreates releases,from a source repository to a target repository

gh migrate-releases sync --source-hostname github.example.com --source-organization <source-org> --source-token <source-token> --repository <repo-name> --target-organization <target-org> --target-token <target-token> --mapping-file "path/to/user-mappings.csv"
Usage:
  migrate-releases sync [flags]

Flags:
  -h, --help                          help for sync
  -m, --mapping-file string           Mapping file path to use for mapping members handles
  -r, --repository string             repository to export/import releases from/to; can't be used with --repository-list
  -l, --repository-list-file string   file path that contains list of repositories to export/import releases from/to; can't be used with --repository
  -u, --source-hostname string        GitHub Enterprise source hostname url (optional) Ex. github.example.com
  -s, --source-organization string    Source Organization to sync releases from
  -a, --source-token string           Source Organization GitHub token. Scopes: read:org, read:user, user:email
  -t, --target-organization string    Target Organization to sync releases from
  -b, --target-token string           Target Organization GitHub token. Scopes: admin:org

Repository List Example

A list of repositories can be provided to sync releases from multiple repositories to many repositories in a single target.

Example:

https://github.example.com/owner/repo-name
https://github.example.com/owner/repo-name2

or

owner/repo-name
owner/repo-name2

Mapping File Example

A mapping file can be provided to map member handles in case they are different between source and target.

Example:

source,target
flastname,firstname.lastname

Disclaimers

This tool uses the GitHub Releases API to create and update releases. Therefore, the release author is the user whose token is used to create the release. This tool does not attempt to recreate the original release author.

In addition, the dates of the release will be the date the release was created, not the original release date. However, this tool will write as part of the release body the original release created_at and published_at timestamps.

If this CLI tool is run through GitHub Actions and it was triggers by an issue_event, the tool will write a comment to the issue with the status of the release migration.

License

About

GH CLI extension to assist in the migration of releases between GitHub repositories

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages