Github actions -如何使用Github API下载工作流日志?



我试图在工作流完成时获得构建日志。我遵循了这个文档。但是我得到以下错误:

"message": "Not Found",
"documentation_url": "https://docs.github.com/rest"

我不知道我哪里做错了。谁来告诉我怎么下载日志?

Workflow.yml:

name: Get logs
on: push
jobs:
build:
runs-on: ubuntu-latest
name: get workflow logs
permissions:
actions: read
steps:
- name: Hello World
id: helloresponse
run: echo Hello, world!
- name: create log
if: always()
id: createlog
run: |
curl --request GET 
-H "Accept: application/vnd.github.v3+json" 
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' 
--header 'content-type: application/json' 
https://api.github.com/repos/${{github.owner}}/${{github.repository}}/actions/runs/${{ github.run_id }}/log

我认为终点是logs而不是log

https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-logs

最新更新