Enable `project_name` as a valid badge token
What does this MR do and why?
The following MR adds project_name
as an additional token that can be used when created a badge. Currently, only project_path
, project_id
, default_branch
, and commit_sha
are accepted.
The project_name
token is necessary if one wishes to generalize a badge link or url. For example for docker pulls: https://img.shields.io/docker/pulls/julienlecomte/%{project_name}
() or pypi downloads: https://img.shields.io/pypi/status/%{project_name}
This simple addition has been asked multiple times (#22278 (closed), with 49 pages_url
, project_slug
, etc...)
Once this MR is accepted, I'll look into adding more depending on demand (a search on gitlab issues), and URL validation on the badges form (which I did not touch in this MR)
How to set up and validate locally
On a project badge settings, use the folling link for a badge: "https://example.com/name=%{project_name}". On the project badge, verify badge shows correct link.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.