Skip to content

Investigate using Actions API to retrieve single job run logs #11118

Description

@babakks

Context

We have had a good number of issues pointing out gh run view (--log | --log-failed) command fails to display the requested job run logs. One of the reasons, for most of the cases, was the changes made to the ZIP file structure (i.e. file naming and sanitisation of special chars) that gh downloads to extract the logs from.

Suggested approach

As of our internal comms, @robherley, suggested using this API endpoint to fetch individual job run logs.

We need to investigate this and see how we can use this endpoint, and potentially replacing the code around handling downloaded ZIP archives.

Expected outcomes

  • We know if we can safely replace the current behaviour, with the use of the new endpoint API, or at least use the mentioned endpoint in specific scenarios.
  • Either:
    • Another issue is created with clear expectations to proceed with the implementation.
    • This is issue is closed with a comment explaining why we're abandoning the idea.

Activity

  1. added
    coreThis issue is not accepting PRs from outside contributors
    gh-runrelating to the gh run command
    on Jun 16, 2025
  2. babakks commented on Jun 25, 2025

    @babakks
    MemberAuthor

    @williammartin and I looked into this to see if/how we can use the suggested API endpoint.

    Limits of the new approach

    It turned out that this new endpoint cannot replace our current approach (i.e. downloading ZIP archive of logs) due to the following reasons:

    1. Missing step-wise logs: the log trail returned by the endpoint is an entire job run trail with no indication of individual steps (i.e. we cannot associate lines with their steps), while the ZIP archive (current approach) provides us with individual step logs (in addition to an entire job run log).

      • This is an important issue, because when gh displays the logs it prepends every line with the corresponding step name.
      • Also, the --log-failed option which is meant to show the logs of the failed steps, will not be useless if we don't have the step logs.
    2. Performance issue: the API endpoint is meant to be used to retrieve the logs of a single job run. However, when a user runs gh run view --log <RUN-ID>, gh will show the log of all jobs in the given run. If gh were to use this API endpoint, then it would have to make repeated API calls, which can be a remarkable number, like in matrix workflows. But in our current approach, only one API call to download the ZIP file is made. Also, despite the performance issue, the user might hit their rate-limit, avoiding which is complicated.

    Use API as a fallback

    Currently, it happens that the job/step log files are not found in the downloaded ZIP archive, and gh displays nothing. Using this API endpoint as a fallback mechanism, can bring us value. We tried the approach and it works as it should. Coincidentally, this fallback mechanism also resolves other issues reported by our lovely community (#11059, #10868). However, we still have to improve our ZIP archive approach and fill in the gaps with the new Actions backend service (#10868).

  3. babakks commented on Jun 25, 2025

    @babakks
    MemberAuthor

    Created #11169 as a follow up to implement the fallback mechanism.

    So, this issue/investigation is completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreThis issue is not accepting PRs from outside contributorsgh-runrelating to the gh run command

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions