如何在gitlab中为我的项目创建徽章?
我知道这里有一个网页https://docs.gitlab.com/ee/user/project/badges.html
但我不知道他们在说什么。
假设我的项目在这里https://gitlab.com/username/userproject
什么应该是链接和徽章图像链接?
通常,您可以从相应的服务获取徽章的URL。
例如,您的仓库的管道批次的URL将是:
https://gitlab.com/username/userproject/badges/master/pipeline.svg)
要将其添加到README,您将使用以下markdown代码:
[![pipeline status](https://gitlab.com/user/userproject/badges/master/pipeline.svg)](https://gitlab.com/user/userproject/commits/master)
注意:此批处理是主分支的管道批处理。对于不同分支的管道批处理,您只需将master
替换为相应的分支名称即可。
屏幕截图中的文件:https://gitlab.com/gitlab-org/gitlab-ee/blob/master/README.md
有两个默认徽章:管道和覆盖范围。示例网址为:
https://gitlab.com/username/userproject/badges/master/pipeline.svg
https://gitlab.com/username/userproject/badges/master/coverage.svg
但您也可以设置自定义徽章。但你必须自己创建它们。对于公共存储库,您可以使用Shields.io或私人存储库等服务,您可以使用AnyBadge(需要在构建链中使用python解释器。以下是如何设置自定义徽章的示例:Adding Custom badges to Gitlab
当您查看更大的存储库(例如this)时,您可以查看图像的路径并查看它们的创建位置。