Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downloading GitHub Actions workflow logs using GitHub api

I am trying to download the logs of a particular workflow in GitHub. I have referenced the following link for the same. However I am getting 302 as response code. Not sure what the issue here is. Its not downloading logs as expected

 curl -v -u username:$token -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/ORGANIZATION/REPOSITORY/actions/runs/319282523477/logs
.
.
< HTTP/1.1 302 Found
< Date: Wed, 21 Oct 2020 07:47:13 GMT
< Content-Type: text/html;charset=utf-8
.
like image 737
codeaprendiz Avatar asked Mar 15 '26 20:03

codeaprendiz


2 Answers

As per the same documentation that you mentioned:

Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for Location: in the response header to find the URL for the download

Response Status: 302 Found

So you might have already got the url to download the logs as the response has a 302 http status. Please check for the Location: response header, which should give you the url that you need to download the logs.

like image 193
Madhu Bhat Avatar answered Mar 18 '26 22:03

Madhu Bhat


As a side note to Madhu Bhat's answer, you can simply add -L to your curl command to make it follow redirects.

(from curl --help)

 -L, --location      Follow redirects
like image 37
Ferdi Llaca Avatar answered Mar 18 '26 23:03

Ferdi Llaca



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!