View Source GitHub.Migrations (GitHub REST API Client v0.3.3)

Provides API endpoints related to migrations

Link to this section Summary

Functions

Delete an organization migration archive

Download an organization migration archive

Get an organization migration status

List organization migrations

List repositories for a user migration

List repositories in an organization migration

Start an organization migration

Link to this section Functions

Link to this function

cancel_import(owner, repo, opts \\ [])

View Source
@spec cancel_import(String.t(), String.t(), keyword()) ::
  :ok | {:error, GitHub.Error.t()}

Cancel an import

Stop an import for a repository.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

resources

Resources

Link to this function

delete_archive_for_authenticated_user(migration_id, opts \\ [])

View Source
@spec delete_archive_for_authenticated_user(
  integer(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Delete a user migration archive

Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the List user migrations and Get a user migration status endpoints, will continue to be available even after an archive is deleted.

resources

Resources

Link to this function

delete_archive_for_org(org, migration_id, opts \\ [])

View Source
@spec delete_archive_for_org(String.t(), integer(), keyword()) ::
  :ok | {:error, GitHub.Error.t()}

Delete an organization migration archive

Deletes a previous migration archive. Migration archives are automatically deleted after seven days.

resources

Resources

Link to this function

download_archive_for_org(org, migration_id, opts \\ [])

View Source
@spec download_archive_for_org(String.t(), integer(), keyword()) ::
  :ok | {:error, GitHub.Error.t()}

Download an organization migration archive

Fetches the URL to a migration archive.

resources

Resources

Link to this function

get_archive_for_authenticated_user(migration_id, opts \\ [])

View Source
@spec get_archive_for_authenticated_user(
  integer(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Download a user migration archive

Fetches the URL to download the migration archive as a tar.gz file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects:

  • attachments
  • bases
  • commit_comments
  • issue_comments
  • issue_events
  • issues
  • milestones
  • organizations
  • projects
  • protected_branches
  • pull_request_reviews
  • pull_requests
  • releases
  • repositories
  • review_comments
  • schema
  • users

The archive will also contain an attachments directory that includes all attachment files uploaded to GitHub.com and a repositories directory that contains the repository's Git data.

resources

Resources

Link to this function

get_commit_authors(owner, repo, opts \\ [])

View Source
@spec get_commit_authors(String.t(), String.t(), keyword()) ::
  {:ok, [GitHub.PorterAuthor.t()]} | {:error, GitHub.Error.t()}

Get commit authors

Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username hubot into something like hubot <hubot@12341234-abab-fefe-8787-fedcba987654>.

This endpoint and the Map a commit author endpoint allow you to provide correct Git author information.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

options

Options

  • since: A user ID. Only return users with an ID greater than this ID.

resources

Resources

Link to this function

get_import_status(owner, repo, opts \\ [])

View Source
@spec get_import_status(String.t(), String.t(), keyword()) ::
  {:ok, GitHub.Import.t()} | {:error, GitHub.Error.t()}

Get an import status

View the progress of an import.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

Import status

This section includes details about the possible values of the status field of the Import Progress response.

An import that does not have errors will progress through these steps:

  • detecting - the "detection" step of the import is in progress because the request did not include a vcs parameter. The import is identifying the type of source control present at the URL.
  • importing - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include commit_count (the total number of raw commits that will be imported) and percent (0 - 100, the current progress through the import).
  • mapping - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information.
  • pushing - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include push_percent, which is the percent value reported by git push when it is "Writing objects".
  • complete - the import is complete, and the repository is ready on GitHub.

If there are problems, you will see one of these in the status field:

  • auth_failed - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the Update an import section.
  • error - the import encountered an error. The import progress response will include the failed_step and an error message. Contact GitHub Support for more information.
  • detection_needs_auth - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the Update an import section.
  • detection_found_nothing - the importer didn't recognize any source control at the URL. To resolve, Cancel the import and retry with the correct URL.
  • detection_found_multiple - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a project_choices field with the possible project choices as values. To update project choice, please see the Update an import section.

The project_choices field

When multiple projects are found at the provided URL, the response hash will include a project_choices field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type.

Git LFS related fields

This section includes details about Git LFS related fields that may be present in the Import Progress response.

  • use_lfs - describes whether the import has been opted in or out of using Git LFS. The value can be opt_in, opt_out, or undecided if no action has been taken.
  • has_large_files - the boolean value describing whether files larger than 100MB were found during the importing step.
  • large_files_size - the total size in gigabytes of files larger than 100MB found in the originating repository.
  • large_files_count - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request.

resources

Resources

Link to this function

get_large_files(owner, repo, opts \\ [])

View Source
@spec get_large_files(String.t(), String.t(), keyword()) ::
  {:ok, [GitHub.PorterLargeFile.t()]} | {:error, GitHub.Error.t()}

Get large files

List files larger than 100MB found during the import

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

resources

Resources

Link to this function

get_status_for_authenticated_user(migration_id, opts \\ [])

View Source
@spec get_status_for_authenticated_user(
  integer(),
  keyword()
) :: {:ok, GitHub.Migration.t()} | {:error, GitHub.Error.t()}

Get a user migration status

Fetches a single user migration. The response includes the state of the migration, which can be one of the following values:

  • pending - the migration hasn't started yet.
  • exporting - the migration is in progress.
  • exported - the migration finished successfully.
  • failed - the migration failed.

Once the migration has been exported you can download the migration archive.

options

Options

  • exclude

resources

Resources

Link to this function

get_status_for_org(org, migration_id, opts \\ [])

View Source
@spec get_status_for_org(String.t(), integer(), keyword()) ::
  {:ok, GitHub.Migration.t()} | {:error, GitHub.Error.t()}

Get an organization migration status

Fetches the status of a migration.

The state of a migration can be one of the following values:

  • pending, which means the migration hasn't started yet.
  • exporting, which means the migration is in progress.
  • exported, which means the migration finished successfully.
  • failed, which means the migration failed.

options

Options

  • exclude: Exclude attributes from the API response to improve performance

resources

Resources

Link to this function

list_for_authenticated_user(opts \\ [])

View Source
@spec list_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.Migration.t()]} | {:error, GitHub.Error.t()}

List user migrations

Lists all migrations a user has started.

options

Options

resources

Resources

Link to this function

list_for_org(org, opts \\ [])

View Source
@spec list_for_org(
  String.t(),
  keyword()
) :: {:ok, [GitHub.Migration.t()]} | {:error, GitHub.Error.t()}

List organization migrations

Lists the most recent migrations, including both exports (which can be started through the REST API) and imports (which cannot be started using the REST API).

A list of repositories is only returned for export migrations.

options

Options

resources

Resources

Link to this function

list_repos_for_authenticated_user(migration_id, opts \\ [])

View Source
@spec list_repos_for_authenticated_user(
  integer(),
  keyword()
) :: {:ok, [GitHub.Repository.minimal()]} | {:error, GitHub.Error.t()}

List repositories for a user migration

Lists all the repositories for this user migration.

options

Options

resources

Resources

Link to this function

list_repos_for_org(org, migration_id, opts \\ [])

View Source
@spec list_repos_for_org(String.t(), integer(), keyword()) ::
  {:ok, [GitHub.Repository.minimal()]} | {:error, GitHub.Error.t()}

List repositories in an organization migration

List all the repositories for this organization migration.

options

Options

resources

Resources

Link to this function

map_commit_author(owner, repo, author_id, body, opts \\ [])

View Source
@spec map_commit_author(String.t(), String.t(), integer(), map(), keyword()) ::
  {:ok, GitHub.PorterAuthor.t()} | {:error, GitHub.Error.t()}

Map a commit author

Update an author's identity for the import. Your application can continue updating authors any time before you push new commits to the repository.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

resources

Resources

Link to this function

set_lfs_preference(owner, repo, body, opts \\ [])

View Source
@spec set_lfs_preference(String.t(), String.t(), map(), keyword()) ::
  {:ok, GitHub.Import.t()} | {:error, GitHub.Error.t()}

Update Git LFS preference

You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by Git LFS.

You can learn more about our LFS feature and working with large files on our help site.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

resources

Resources

Link to this function

start_for_authenticated_user(body, opts \\ [])

View Source
@spec start_for_authenticated_user(
  map(),
  keyword()
) :: {:ok, GitHub.Migration.t()} | {:error, GitHub.Error.t()}

Start a user migration

Initiates the generation of a user migration archive.

resources

Resources

Link to this function

start_for_org(org, body, opts \\ [])

View Source
@spec start_for_org(String.t(), map(), keyword()) ::
  {:ok, GitHub.Migration.t()} | {:error, GitHub.Error.t()}

Start an organization migration

Initiates the generation of a migration archive.

resources

Resources

Link to this function

start_import(owner, repo, body, opts \\ [])

View Source
@spec start_import(String.t(), String.t(), map(), keyword()) ::
  {:ok, GitHub.Import.t()} | {:error, GitHub.Error.t()}

Start an import

Start a source import to a GitHub repository using GitHub Importer. Importing into a GitHub repository with GitHub Actions enabled is not supported and will return a status 422 Unprocessable Entity response.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

resources

Resources

Link to this function

unlock_repo_for_authenticated_user(migration_id, repo_name, opts \\ [])

View Source
@spec unlock_repo_for_authenticated_user(integer(), String.t(), keyword()) ::
  :ok | {:error, GitHub.Error.t()}

Unlock a user repository

Unlocks a repository. You can lock repositories when you start a user migration. Once the migration is complete you can unlock each repository to begin using it again or delete the repository if you no longer need the source data. Returns a status of 404 Not Found if the repository is not locked.

resources

Resources

Link to this function

unlock_repo_for_org(org, migration_id, repo_name, opts \\ [])

View Source
@spec unlock_repo_for_org(String.t(), integer(), String.t(), keyword()) ::
  :ok | {:error, GitHub.Error.t()}

Unlock an organization repository

Unlocks a repository that was locked for migration. You should unlock each migrated repository and delete them when the migration is complete and you no longer need the source data.

resources

Resources

Link to this function

update_import(owner, repo, body, opts \\ [])

View Source
@spec update_import(String.t(), String.t(), map() | nil, keyword()) ::
  {:ok, GitHub.Import.t()} | {:error, GitHub.Error.t()}

Update an import

An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted.

Some servers (e.g. TFS servers) can have several projects at a single URL. In those cases the import progress will have the status detection_found_multiple and the Import Progress response will include a project_choices array. You can select the project to import by providing one of the objects in the project_choices array in the update request.

Warning: Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

resources

Resources