gh-gei icon indicating copy to clipboard operation
gh-gei copied to clipboard

gh gei download-logs fails to download

Open jil-sc opened this issue 4 months ago • 1 comments

Description

After the migration has been finished the migration log is available in the issue comment. However, downloading the logs with gh gei fails:

gh gei download-logs --github-target-pat $GH_PAT --github-target-org myorg --target-repo myrepo --verbose
[2025-09-02 08:23:32] [INFO] You are running an up-to-date version of the gei CLI [v1.18.0]
[2025-09-02 08:23:32] [INFO] GITHUB ORG: myorg
[2025-09-02 08:23:32] [INFO] GITHUB REPO: myrepo
[2025-09-02 08:23:32] [INFO] GITHUB PAT: ***
[2025-09-02 08:23:32] [INFO] VERBOSE: true
[2025-09-02 08:23:32] [WARNING] Migration logs are only available for 24 hours after a migration finishes!
[2025-09-02 08:23:32] [INFO] Downloading migration logs...
[2025-09-02 08:23:32] [DEBUG] HTTP POST: https://api.github.com/graphql
[2025-09-02 08:23:32] [DEBUG] HTTP BODY: {"query":"query ($org: String!, $repo: String!) { \n                organization(login: $org) {\n                    repositoryMigrations(last: 1, repositoryName: $repo) {\n                        nodes {\n                            id\n                            migrationLogUrl\n                        }\n                    }\n
        }\n             }","variables":{"org":"myorg","repo":"myrepo"}}
[2025-09-02 08:23:33] [DEBUG] GITHUB REQUEST ID: BA18:9F034:5C460:567F3:68B6A985
[2025-09-02 08:23:33] [DEBUG] RESPONSE (OK): {"data":{"organization":{"repositoryMigrations":{"nodes":[]}}}}
[2025-09-02 08:23:33] [ERROR] OctoshiftCLI.OctoshiftCliException: Migration for repository myrepo not found!
   at OctoshiftCLI.Commands.DownloadLogs.DownloadLogsCommandHandler.Handle(DownloadLogsCommandArgs args)
   at OctoshiftCLI.Extensions.CommandExtensions.RunHandler[TArgs,THandler](TArgs args, ServiceProvider sp, CommandBase`2 command)
   at OctoshiftCLI.Extensions.CommandExtensions.<>c__DisplayClass1_0`3.<<ConfigureCommand>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Reproduction Steps

  1. run repository migration
  2. run gh gei download-logs

jil-sc avatar Sep 02 '25 08:09 jil-sc

Workaround:

issue_number=$(gh api /repos/$target_org/$target_repo/issues \
                                -q '.[] | select(.title == "Migration Log") | .number' )
gh api /repos/$target_org/$target_repo/issues/$issue_number/comments  -q '.[].body' 

jil-sc avatar Sep 02 '25 08:09 jil-sc