英文:
Possibility of Storing the Output of Step in Github Action
问题
我正在尝试确定在GitHub Actions中是否有一种方法可以保存完整步骤的输出,即GitHub控制台上显示的任何内容都可以以某种方式存储或保存,以便我可以将其重定向到文件或其他地方。
这里是一个快照,其中一个插件显示了详细的输出,我想将此信息存储或传递到文件以供进一步使用:
我认为这甚至可以称为日志。
直到目前为止,还无法弄清楚如何做到这一点。
英文:
I am trying to figure out if there is a way in GitHub Actions where we can save the output of a step in its entirety, i.e whatever was displayed on the GitHub console, can be stored or saved in a way so that I can be redirected into a file or something.
Here is a snapshot, where a plugin displayed a verbose output, I would like to store or pass on this info in a file for further use:
I think this might even be called logs.
Could not figure it out anyway until yet.
答案1
得分: 1
以下是翻译好的部分:
如果我们只关注aquasecurity/trivy-action(似乎是问题中的日志),它已经提供了一个配置选项 output
来指定一个输出文件来存储其输出。
根据其inputs,您可以使用 output
:
output
| 保存结果到文件
并且,还可以根据您的要求配置 format
(默认值:table
):
format
| 输出格式(table
,json
,sarif
,github
)
使用 format: json
,然后可以使用jq
进行轻松操作。
除此之外,要获取日志,您可以使用GitHub CLI,即 gh run view
。
请查看使用GitHub CLI查看日志 和关于GitHub CLI以获取更多详细信息。
您还可以使用GitHub API。请查看下载工作流运行尝试日志。
英文:
If we only focus on the aquasecurity/trivy-action here (which seems to be the logs in question) then it already provides a configuration option output
to specify an output file to store its output.
According to its inputs, you can use output
:
> output
| Save results to a file
and, also configure a format
according to your requirements (default: table
):
> format
| Output format (table
, json
, sarif
, github
)
With format: json
, you can then use jq
for easy manipulation.
Apart from that, to get the logs, you can use the GitHub CLI i.e. gh run view
.
See Viewing logs with GitHub CLI and About GitHub CLI for more details.
You can also use the GitHub API. See Download workflow run attempt logs.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论