![](/img/trans.png)
[英]Github actions - How to Download the workflow logs using Github API?
[英]Downloading github actions workflow logs using github api
我正在嘗試下載 github 中特定工作流程的日志。我已經參考了以下鏈接。 但是我得到 302 作為響應代碼。 不確定這里的問題是什么。 它沒有按預期下載日志
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
.
作為 Madhu Bhat 回答的旁注,您只需將-L
添加到您的curl
命令中即可使其遵循重定向。
(來自curl --help
)
-L, --location Follow redirects
根據您提到的同一文檔:
獲取重定向 URL 以下載工作流作業的純文本日志文件。 此鏈接將在 1 分鍾后失效。 查找
Location:
在響應頭中查找下載的 URL
響應狀態:302 找到
因此,您可能已經獲得了下載日志的 url,因為響應具有302 http status 。 請檢查Location:
響應標頭,它應該為您提供下載日志所需的 URL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.