Issues in the api wrappers while downloading logs
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start with the actions.download_workflow_run_logs, list_jobs_for_workflow_run, and download_job_logs_for_workflow_run wrappers, then run the reproduction script from the issue. Inspect fastcore's urlsend() handling of application/zip and plain-text responses; done means both wrappers return their raw response bodies without JSON decoding errors.
Written by the indexing model from the issue text.
Description
Hi, I stumbled upon this 2 bugs while trying out your project. It seems to me that those 2 functions that present the issue (actions.download_workflow_run_logs and actions.list_jobs_for_workflow_run) are working under the assumption that they're going to receive json, which is not the case. The first will receive a zip file (in the form of a byte array), while the second will receive the raw logs in the body of the response.
To reproduce:
from ghapi.all import GhApi
api = GhApi(owner='fastai', repo='fastcore')
res_runs = api.actions.list_workflow_runs_for_repo(status='completed',per_page=5,page=1) # last 5 workflow_runs of your proj
for run in res_runs.workflow_runs.items:
try:
res = api.actions.download_workflow_run_logs(run.id) # gets a zip (byte array)
except Exception as bug1:
print(bug1)
res_jobs = api.actions.list_jobs_for_workflow_run(run_id=run.id)
for job in res_jobs.jobs.items:
try:
res = api.actions.download_job_logs_for_workflow_run(job.id) # gets plain text
except Exception as bug2:
print(bug2)
The problem to me seems that the urlsend() method in the fastcore dependency does not care about the response type, but tries to json decode the content, no matter what. Which fails because the Content-Type is, respectively, plain/text and application/zip
- Dominant language
- Python
- Stars
- 687
- Forks
- 69
- Avg merge
- 1m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AnswerDotAI/ghapi
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AnswerDotAI/ghapi#158 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AnswerDotAI/ghapi#120 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
AnswerDotAI/ghapi#208 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
AnswerDotAI/ghapi#201 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
AnswerDotAI/ghapi#186 ·
All issues in AnswerDotAI/ghapi
Similar issues
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100