Skip to content

Ability to view specific job's step logs #11157

Open

Description

@dlvhdr

Describe the feature or problem you’d like to solve

Currently the gh cli allows you to view a job's logs with:

gh run view -R neovim/neovim --log --job=43904694235

This fetches the entire output of the job.

I would like the ability to only view logs of a specific step of the job.

The GitHub UI does fetch a specific step logs by calling:

https://github.com/neovim/neovim/commit/7935cf4f7f35150d3c04e719938046d4cfa8f905/checks/43904694235/logs/2

This endpoint is not exposed by the GitHub API.

Proposed solution

I would imagine something like:

gh run view -R neovim/neovim --log --job=43904694235 --step=3

An alternative solution would be to solve https://github.com/orgs/community/discussions/41351 which would add more accurate timestamps to a step's startedAt and completedAt.
This would allow me to correlate the steps logs from the full job logs.

Additional context

I would like to build a UI similar to github's job page.
The page allows the user to expand the different steps of the job, and see only the correlated logs.

Activity

  1. added
    enhancement
    on Jun 21, 2025
  2. added
    needs-triage
    on Jun 21, 2025
  3. williammartin commented on Jun 21, 2025

    @williammartin
    Member

    Hey @dlvhdr,

    When you run gh run view -R neovim/neovim --log --job=43904694235 the second column in most cases should contain the step name that you could filter on but I see that specific example reports UNKNOWN STEP. We have a few open issues with the actions team about resolving this. I don't think it would be tremendously hard to add --step but just curious if you would still need that if the step was correctly reported in the log output and you could grep it. Helps us prioritise!

  4. added
    more-info-needed
    on Jun 21, 2025
  5. dlvhdr commented on Jun 21, 2025

    @dlvhdr
    Author

    Hey @williammartin, this would definitely help!

    But, currently, I haven't seen a case where the step is different than UNKNOWN STEP.
    I've checked various repos and jobs and always get only these.

    e.g. running:

    $ gh run view -R cli/cli --log --job=44507380755 | awk -F '\t' '{print $2}' | uniq
    UNKNOWN STEP

    In other cases, gh fails to find the logs because of #11059

  6. williammartin commented on Jun 21, 2025

    @williammartin
    Member

    Got it, yes any time we see UNKNOWN STEP it's a result of the log service having been changed underneath the CLI. All the reports of this being a problem are useful to us getting the prioritised so thanks for opening this up. Vaguely recall that it most commonly occurs after some period of time and if you get the logs shortly after the run, the steps will be there.

  7. added
    gh-run
    on Jun 23, 2025
  8. andyfeller commented on Jun 23, 2025

    @andyfeller
    Contributor

    Catching up on this conversation, I believe CLI maintainers need to collaborate with Actions team on a more accurate solution than slicing job logs by timestamp.

    The GitHub UI does fetch a specific step logs by calling:

    https://github.com/neovim/neovim/commit/7935cf4f7f35150d3c04e719938046d4cfa8f905/checks/43904694235/logs/2
    

    This endpoint is not exposed by the GitHub API.

    An alternative solution would be to solve https://github.com/orgs/community/discussions/41351 which would add more accurate timestamps to a step's startedAt and completedAt.
    This would allow me to correlate the steps logs from the full job logs.

    I think the API challenges in this issue are due the larger check suites and runs framework that GitHub Actions workflow runs and jobs are built on, which doesn't have any concept that maps to GitHub Actions workflow run steps.

    So I imagine the GitHub Actions logs are stored as a whole, which would require an API endpoint that could parse the logs for clients to return the step specific portion.

    Ideally, it would be nice if the log file contained metadata denoting the separate steps.

  9. dlvhdr commented on Dec 10, 2025

    @dlvhdr
    Author

    Just to help clarify, adding a --step flag would not solve my issue entirely.
    Some of of the steps in our company's CI are huge and contain 20K lines.
    Fetching the entire run can take upwards of 20 seconds.
    I would like to avoid fetching these steps and doing something similar to the github website where it can fetch only a specific step's logs. E.g. https://github.com/neovim/neovim/commit/7935cf4f7f35150d3c04e719938046d4cfa8f905/checks/43904694235/logs/2

  10. added
    needs-investigation
    and removed
    more-info-needed
    needs-triage
    on Mar 4, 2026
  11. chawyehsu commented on May 8, 2026

    @chawyehsu

    I’m trying to implement a somewhat tricky task: accessing the logs of the previous step from within a running GitHub Actions workflow in order to determine certain things.

    While testing the currently used /repos/{owner}/{repo}/actions/jobs/{job_id}/logs endpoint, I realized that it's not possible to retrieve logs for a job while the job is still running, because the API only provides the complete log archive and returns 404 for unfinished jobs. (there was SO question https://stackoverflow.com/questions/74042833/ taking about similar situation)

    Then I discovered https://github.com/{owner}/{repo}/commit/{commit_id}/checks/{job_id}/logs/{step_id} from the GitHub Actions Web UI, which actually fits this use case. However, it's not a public API, and it's also inaccessible through the gh CLI even though it requires authentication (you can't access with token but cookie).

    Hope the GitHub Actions and CLI teams can work together to make this officially supported and publicly accessible.

  12. Scalahansolo commented on May 9, 2026

    @Scalahansolo

    @williammartin would GitHub consider exposing per-step Actions logs through the supported API/auth model?

    Ideally something centered on the job/run URL users already have, e.g.
    GET /repos/{owner}/{repo}/actions/jobs/{job_id}/steps
    GET /repos/{owner}/{repo}/actions/jobs/{job_id}/steps/{step_number}/logs

    or an equivalent supported version of:
    https://github.com/{owner}/{repo}/runs/{job_id}/logs/{step_number}

    The web UI already has this data via steps?change_id=0 and per-step log URLs, but those seem tied to browser session auth rather than GitHub App installation tokens / PAT API auth.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgh-runneeds-investigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions