Enable `project_name`, `project_title` as a valid badge tokens
What does this MR do and why?
The following MR adds project_name
and project_path
as an additional tokens that can be used when created a badge. Currently, only project_path
, project_id
, default_branch
, and commit_sha
are accepted.
This MR is a revised version of !103122 (merged). The previous MR used project_name
as what was actually a project title. A project title may contains spaces, and it would be unexpected for a user, myself included, that the project_name
used a placeholder in a url contain spaces.
For this reason, project_name
is now linked to the project path (the name of the repository as a path component). project_path
is not used for it is already used and changing it would lead to breakage. project_title
links to the title.
In other words: project_name
== my-awesome-project
, project_title
== My Awesome Project
, project_path
==my-group/my-awesome-project
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
Screenshots or screen recordings
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}&title=%{project_title}". 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.