Adding Status Badges
This document describes how to create a badge that displays your project’s build status (passed or failed) in a README or other document.
Overview
Status badges are commonly embedded in project READMEs, although they can be placed in any web document. CircleCI provides a tool to generate embed code for status badges. By default, a badge displays the status of a project’s default branch, though you can also display the status of specific branches.
You can generate code for the following formats:
- 图像网址
- 啰嗦
- 纺织品
- rdoc.
- AsciiDoc
- 重组修改
- pod
生成状态徽章
To generate your own status badge, you will need to know and substitute the following variables in the code snippets below:
- 您的项目名称。例:Circleci.-docs
。
- The organization or user name the project in question belongs to.
- 您的VCS提供商(gh
for “github” andbb
for BitBucket).- The link you want the status badge to go to when clicked (example: the pipeline overview page).
- 可选:API令牌(为私人项目创建徽章)。
以下示例演示了如何为各种模板语言生成状态徽章。每个样本还提供特定分支的状态徽章代码的示例。
# Template: []() # Example: [](//www.drag240sx.com/gh/circleci/circleci-docs) # Example for specific branch: [](//www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5)
# Template: !//www.drag240sx.com///.svg?style=svg!: # Example: !//www.drag240sx.com/gh/circleci/circleci-docs.svg?style=svg!://www.drag240sx.com/gh/circleci/circleci-docs # Example for specific branch: !//www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5.svg?style=svg!://www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5
#template:{
/uteg_name>/< project_name> .svg?style=svg”alt =“”/>} [https://Circleci.。com/gh//] # Example: {
}[//www.drag240sx.com/gh/circleci/circleci-docs] # Example for specific branch: {
}[//www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5]
#模板:图片:https://www.drag240sx.com/ / / .svg?style = svg [“”,link =“//www.drag240sx.com/ / / “]#示例:图片:https://www.drag240sx.com/gh/circleci/circleci-docs.svg?style = svg [”circleci“,link =”https:// circleci。com/gh/circleci/circleci-docs"] # Example for specific branch: image://www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5.svg?style=svg["CircleCI", link="//www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5"]
# Template: .. image:: //www.drag240sx.com///.svg?style=svg :target: //www.drag240sx.com/// # Example: .. image:: //www.drag240sx.com/gh/circleci/circleci-docs.svg?style=svg :target: //www.drag240sx.com/gh/circleci/circleci-docs # Example for specific branch: .. image:: //www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5.svg?style=svg :target: //www.drag240sx.com/gh/circleci/circleci-docs/tree/teesloane-patch-5
为私人存储库创建徽章
注意:To create a status badge for a private project you will need to create anapi tokenspecifically scoped to “status”并在徽章的URL字符串中包含该标记。考虑下面的Markdown Image徽章片段,针对上面的原始标记示例;它有一个添加令牌的URL参数。
[]()
To create a status api token, go to yourProject’s Settings(present on the top right corner) >API权限and create a token scoped toStatus
。
不同的风格
If you find the default status badge too minimal, you can use theshield style。使用屏蔽风格,更换style = svg.
借风格=盾
在您在上面生成的链接中。