github / github/gh-gei

`gh gei generate-script --download-migration-logs` tries to download logs even when the migration wasn't started

Open
#861 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
478
Forks
146
Avg merge
7d 21h
Merged PRs (30d)
2

Description

## Description

`gh gei generate-script`'s `--download-migration-logs` allows you to generate a migration script which downloads the logs to the local machine at the end of the migrations.

At the moment, if the migration doesn't get started (for example because of our "does the target repo already exist?" check), we still try to download the migration logs at the end. We shouldn't do this, because we already know that there won't be any migration logs.

You end up with output like this:

```
[13:11] [INFO] You are running the latest version of the gei CLI [v0.34]
[13:11] [INFO] Migrating Repo...
[13:11] [INFO] GITHUB SOURCE ORG: caffeinesoftware
[13:11] [INFO] SOURCE REPO: autolinks-example
[13:11] [INFO] GITHUB TARGET ORG: caffeinesoftware
[13:11] [INFO] TARGET REPO: autolinks-example
[13:11] [WARNING] The Org 'caffeinesoftware' already contains a repository with the name 'autolinks-example'. No operation will be performed
[13:11] [INFO] You are running the latest version of the gei CLI [v0.34]
[13:11] [WARNING] Migration logs are only available for 24 hours after a migration finishes!
[13:11] [INFO] Downloading migration logs...
[13:11] [INFO] GITHUB ORG: caffeinesoftware
[13:11] [INFO] GITHUB REPO: autolinks-example
[13:11] [ERROR] Migration for repository autolinks-example not found!
```

## Reproduction Steps

Generate a script with the `--download-migration-logs` option which runs a migration where the source and destination are the same. This guarantees that the "does the target repo already exist?" check returns true, and that no migrations start, e.g.:

```bash
gh gei generate-script --github-source-org caffeinesoftware --github-target-org caffeinesoftware --download-migration-logs
pwsh migrate.ps1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.