J. *_*Doe 7 github badge github-actions
Does GitHub have an official 'badge' for their new 'actions' feature?
I came across this request on their official repo and there seems to be an official one:
https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg
Run Code Online (Sandbox Code Playgroud)
as per this comment, but I am unable to get it to work. Is it actually working? When I use it, I get the below output:
Note that I have replaced {github_id} with my username, {repository} with my repo name and {workflow_name} with the corresponding workflow name (removing the curly braces). Does anyone else have this issue?
Edit: I am working on a private repo, in case it makes a difference.
Mad*_*hat 42
您可以通过导航到 GitHub.com 上的存储库中所需的工作流程并单击创建状态标志按钮来获取操作标志。
在这里,您可以为所需的分支和事件选择徽章并使用生成的 markdown。
例如,下面是我为主分支生成的徽章,用于CI 工作流的推送事件:
上述徽章的降价:

Run Code Online (Sandbox Code Playgroud)
事实证明,徽章更新/渲染是一个缓慢的过程。将徽章添加到 my 后README.md,我刚开始在另一个分支工作。大约 10 分钟后(至少在我的情况下),徽章出现,但管道状态显示为“未知”。它在大约 10 分钟后再次更新,并具有正确的管道状态(在我的情况下为“通过”)。
所以,一旦你完成了,就继续你的其他东西,它会在某个时候自己更新。希望这可以帮助某人!
我遇到了另一个与包含空格的工作流程名称相关的问题。这些必须使用 URI 转义:
来自 main.yml
name: Hello World
Run Code Online (Sandbox Code Playgroud)
必须使用如下格式的 URI:
https://github.com/{username}/{repository}/workflows/Hello%20World/badge.svg
Run Code Online (Sandbox Code Playgroud)
这不是此处描述的确切问题的正确答案,但它是展示相同诊断的问题的替代补救措施 - 所以我希望它对某人有所帮助。
为我工作:
[GITHUB-BADGE](https://github.com/{username}/{repository}/workflows/{name}/badge.svg)
Run Code Online (Sandbox Code Playgroud)
更多信息:将工作流状态徽章添加到您的存储库