Repository navigation
Use Actions API to retrieve job run logs as a fallback mechanism #11169
Description
Activity
- addedenhancementa request to improve CLIa request to improve CLIcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsgh-runrelating to the gh run commandrelating to the gh run command
on Jun 25, 2025 - linked a pull request that will close this issueUse Actions API to retrieve job run logs as a fallback mechanism #11172
on Jun 26, 2025 @babakks We are on the latest version 2.75.0 where this issue is fixed, but we are still seeing this.
gh --version gh version 2.75.0 (2025-07-09) https://github.com/cli/cli/releases/tag/v2.75.0We have a job skipped due to the conditionals. Does this handles that case ?
Currently it is failing with the error:gh --repo abcd/xyz run view 16266528487 --log ... ... log not found: 4592355393045923553930 --> This corresponds to the skipped job id
Thanks for reporting this, @basaveswar-kureti! 🙏
There's a new issue opened for this (#11311), so please follow up on the updates in there.
Thanks @babakks for your response. Looking forward for the fix. I will be happy to verify the fix.
Please let me know if you need any debug info/logs from my end.Reacted by Babak K. ShandizThanks for your offering, @basaveswar-kureti! I've made PR #11312 which is now pending review. You can check out the PR branch and try building
ghfrom source. If you did that, please let me know your thoughts/observations.Thanks @babakks for the quick fix. I verified and it is working properly.
% /opt/homebrew/bin/gh --repo abcd/xyz run view 16266528487 --log | grep "log not found" log not found: 45923553930 % ./gh --repo abcd/xyz run view 16266528487 --log | grep "log not found" % ./gh version gh version 2.75.1-3-gf67bd9a7d (2025-07-17) https://github.com/cli/cli/releases/latest % git status On branch babakks/avoid-fetching-logs-for-skipped-jobs Your branch is up to date with 'origin/babakks/avoid-fetching-logs-for-skipped-jobs'. nothing to commit, working tree cleanThanks for trying the changes. However, since the error message is printed on stderr the
| grepwouldn't surface it. You can try2>&1 | grepor simply|& grep.Anyway, the PR is on our review list and should be merged before the next release, which is probably due next week. Things can always change, though, so that's just an estimation.
@babakks Checked with 2>&1. It is working as expected.
Thanks for the estimated release date.
Reacted by Babak K. Shandiz
This issue is a follow-up to #11118.
We want to use the Actions API (here) as a fallback mechanism to retrieve job run logs when the current approach (extracting logs from a downloaded ZIP archive) fails.
Other context
As a middle ground to avoid hitting the API too many times in case of huge runs (lots of jobs), we need to apply a restriction on the number of fallback API calls, and display an actionable error message to users.
Acceptance Criteria
1. Fallback to API call
Given I have a job run that is missing from the downloaded ZIP archive
When I run
gh run view --log -j <JOB-RUN-ID>Then I see the job logs, with the step name column filled with "UNKNOWN STEP"
Note
Reproducing this with read data is a bit tricky. Since this fix coincidentally fixes the cases reported in #10868, we can also use those cases to verify the current PR.
2. Error when too many API calls are needed
Given I have a workflow run where more than 25 job log files are missing from the downloaded ZIP archive
When I run
gh run view --log <RUN-ID>Then I get an error indicating I should use the
--joboption (without any API calls being made)