如何访问徽章中的 GitHub 操作输出
我有一个输出数字的 GitHub 操作工作流程,我想将其显示在徽章中。
使用 https://github.com/username/reponame/actions/工作流/myaction.yml/badge.svg 我得到一个红色或绿色的失败/成功徽章,但我想显示失败的数量,工作流将其输出到“错误”输出变量中。
如何访问徽章中的该变量?
I have a GitHub action workflow that outputs a number and I want to display that in a badge.
Using https://github.com/username/reponame/actions/workflows/myaction.yml/badge.svg I get a red or green failing/success badge but I want to display the number of failures instead, which the workflow outputs into the "errors" output variable.
How can I access that variable in a badge?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
选项很少
Github 操作市场中的“自带徽章” - https://github .com/marketplace/actions/bring-your-own-badge
如果您想使用 https://shields.io/,请考虑动态徽章 - https://github.com/marketplace/actions/dynamic-badges
There are few options in Github actions marketplace
Bring Your Own Badge - https://github.com/marketplace/actions/bring-your-own-badge
If you want to use https://shields.io/, consider Dynamic Badges - https://github.com/marketplace/actions/dynamic-badges
您可以在同一工作流程中的后续作业(步骤)中。
我认为您想使用自己的徽章,例如
https://img.shields.io
。我想您将在每次操作完成时更新自述文件,更新步骤将成为工作流程的一部分。输出的传输可以像这里一样完成 在 GitHub Action 的新作业中使用上一作业的输出。
您将在自述文件中附加适当的 svg
[![](https://img.shields.io/badge/TEXT-NUMBER-COLOR?style=flat)](some url)
。In a subsequent job (step) in the same workflow you could.
I think you want to use your own badge using e.g.
https://img.shields.io
.I image you will update e.g. the README file every time the actions are finished, the updating step will be part of the workflow. The transfer of output could be done like here Using output from a previous job in a new one in a GitHub Action.
You will append e.g. the README with a proper svg
[![](https://img.shields.io/badge/TEXT-NUMBER-COLOR?style=flat)](some url)
.我创建了一个操作来从工作流程生成徽章:
Build-A-Badge - https: //github.com/marketplace/actions/build-a-badge
正如其他用户所指出的,我不需要任何外部依赖项或在主存储库上创建新分支。因此,我使用的解决方法是将徽章数据存储在 Wiki 中,这是一个单独的存储库。
I created an action to generate a badge from a workflow:
Build-A-Badge - https://github.com/marketplace/actions/build-a-badge
As other users have pointed out, I didn't want any external dependencies or to create new branches on the main repo. So the workaround I used is to store the badge data in the Wiki, which is a separate repository.