Search code examples
gitlabgitlab-cigitlab-api

how do I add a gitlab badge with a dynamic branch?


I use a closed gitlab repository. the badge is generated as a job artifact (anybadge). %{default_branch} - master

if the branch is master or develop, then everything is simple. I add a link to the badge in the settings:

 https://example.com/%{project_path}/-/jobs/artifacts/master/raw/master.svg?job=badge

but I can't configure adding a badge for the "release/1.1" branch. The value 1.1 is constantly changing. I don't want to change the link in the settings every time.

I would like to add a link like this (release*):

 https://example.com/%{project_path}/-/jobs/artifacts/release*/raw/release.svg?job=badge

Is there any solution for dynamic branches? I will be glad to have any suggestions.

p.s. using the gitlab api badge is a difficult option.


Solution

  • As Adam Marshall already answered, gitlab currently (to my knowledge) has no native way to do this. You can try to achieve something similar with using an external api for badges, e.g. https://shields.io/ , if your project fulfills the requirements.