GitHub动作构建的最后一个工件的URL [英] URL of the last artifact of a GitHub-action build

查看:94
本文介绍了GitHub动作构建的最后一个工件的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GitHub-action进行构建,它会生成多个工件(使用不同的名称).

I use GitHub-action for my build, and it generates multiple artifacts (with a different name).

是否有一种方法可以预测上一次成功构建的工件的URL?在不知道sha1 的情况下,仅是工件和存储库的名称?

Is there a way to predict the URL of the artifacts of the last successful build? Without knowing the sha1, only the name of the artifact and the repo?

推荐答案

目前,根据

At the moment, no, according to comments from staff although this may change with future versions of the upload-artifact action.

自言自语后,可以使用GitHub action API来获得此信息: https://developer.github.com/v3/actions/artifacts/

After poking around myself, it is possible to get this using the GitHub actions API: https://developer.github.com/v3/actions/artifacts/

获取/repos/:owner/:repo/actions/runs/:run_id/artifacts

因此,您可以接收JSON答复并遍历工件"数组以获取相应的"archive_download_url".工作流可以这样填写URL:

So you can receive a JSON reply and iterate through the "artifacts" array to get the corresponding "archive_download_url". A workflow can fill in the URL like so:

/repos/$ {{github.repository}}/actions/runs/$ {{github.run_id}}/artifacts

/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts

这篇关于GitHub动作构建的最后一个工件的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆