在工作流/Github Actions 之间共享工件 [英] Share artifacts between workflows / Github Actions
问题描述
我知道您可以在同一工作流的作业之间共享工件...
I know that you can share artifacts between jobs of the same workflow...
但是如何在不同的工作流程之间共享工件?
But how can I share artifacts across different workflows?
推荐答案
GitHub 现已添加 用于下载工件的 REST API.基本上你会的
GitHub has now added a REST API for downloading artifacts. Basically you do
GET repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}
然后您必须在响应中查找 Location:
,然后访问该 url 以下载工件.网址有效期为 1 分钟.
And then you'll have to look for Location:
in the response, and then access that url to download the artifact. The url is valid for 1 minute.
有一个使用上述 API 的 GitHub Action,您可以轻松地将其添加到您的工作流程中.我是这样用的
There's a GitHub Action that uses the API above that you can easily add to your workflow. I use it like this
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
在此处了解更多信息:https://github.com/dawidd6/action-download-神器
这篇关于在工作流/Github Actions 之间共享工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!