-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement actions badge svgs #28102
Implement actions badge svgs #28102
Conversation
Very nice, even without dependencies 👍 |
This comment was marked as outdated.
This comment was marked as outdated.
I guess the only difference is that the library probably supports more styling options, but that can be added later.
I assume this counts as "Derivative Works" which is allowed in their Apache 2.0 Licence. I would put a comment and link to original repo like this. Not sure if worth it to include a full copy of the license as well, but if we follow it strictly, we should. |
This comment was marked as outdated.
This comment was marked as outdated.
Some docs on this would be nice, like this. |
routers/web/repo/actions/badge.go
Outdated
gF := float64(defaultOffset) | ||
lW := float64(drawer.MeasureString(label)>>6) + gF | ||
mW := float64(drawer.MeasureString(message)>>6) + gF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it right to do so (guessing font size)?
The SVG uses font-family="Geneva,DejaVu Sans,sans-serif"
, do you really know its width on client side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no way knowing how wide it would render on a client, but as long as these approximations work on common clients, I can accept them.
@lng2020 Are you still working on this PR? |
Sorry. I thought this one was replaced by #28585. But it turns out that one was closed last month.
Would you like to take over or would you like me to finish? I can solve most reviews above except the client-side font problem.
Or this PR can be replaced by a more well-designed badge system, which includes more badges like |
So the problem now is that do we need an internal badge system? ps: tried the service mentioned above, it works, but not all things supported. |
I think as a start, we can serve just the action badges, more can come later if there is demand and I think this PR lays a good base, so let's get it finished. |
I think it is good enough for daily usage. Why end users need so long a label. |
As expected. The function calculates the text length is
So the text width is only about 95% of the whole width. If the text is long, the remaining 5% will become noticeable. |
@lng2020 please fix the merge conflicts. 🍵 |
Co-authored-by: delvh <[email protected]>
* giteaofficial/main: (23 commits) Fix wrong test usage of `AppSubURL` (go-gitea#29459) Improve contrast on blame timestamp, fix double border (go-gitea#29482) Fix/Improve `processWindowErrorEvent` (go-gitea#29407) Apply compact padding to small buttons with svg icons (go-gitea#29471) Fix counter display number incorrectly displayed on the page (go-gitea#29448) Fix incorrect user location link on profile page (go-gitea#29474) Fix workflow trigger event bugs (go-gitea#29467) Fix URL calculation in clone input box (go-gitea#29470) Remove jQuery from the "find file" page (go-gitea#29456) Move generate from module to service (go-gitea#29465) The job should always run when `if` is `always()` (go-gitea#29464) Recolor dark theme to blue shade (go-gitea#29283) Let ctx.FormOptionalBool() return optional.Option[bool] (go-gitea#29461) Implement actions badge svgs (go-gitea#28102) Fix missed return (go-gitea#29450) Use tailwind instead of `gt-[wh]-` helper classes (go-gitea#29423) Lock issues and pulls faster (go-gitea#29436) Allow to change primary email before account activation (go-gitea#29412) Update docs about `DEFAULT_ACTIONS_URL` (go-gitea#29442) Only use supported sort order for "explore/users" page (go-gitea#29430) ...
replace #27187
close #23688
The badge has two parts: label(workflow name) and message(action status). 5 colors are provided with 7 statuses.
Color mapping:
preview:
![1](https://private-user-images.githubusercontent.com/70063547/283703572-5465cbaf-23cd-4437-9848-2738c3cb8985.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU2NzEsIm5iZiI6MTcyMzk5NTM3MSwicGF0aCI6Ii83MDA2MzU0Ny8yODM3MDM1NzItNTQ2NWNiYWYtMjNjZC00NDM3LTk4NDgtMjczOGMzY2I4OTg1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE1MzYxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI5YTQ5YjBiYzY1N2U1NzI2MzNlZjYxYjQ3NzY5NWM2ZWM4ZDhkNWQ0NDM5NWZlNWEyZTI3ZTY4MWM4MmI1NGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IkOPlB-Gyj7__DJsHjMlpREPjqfyCbdep6aE5vUR9nk)
![2](https://private-user-images.githubusercontent.com/70063547/283703600-ec393d26-c6e6-4d38-b72c-51f2494c5e71.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU2NzEsIm5iZiI6MTcyMzk5NTM3MSwicGF0aCI6Ii83MDA2MzU0Ny8yODM3MDM2MDAtZWMzOTNkMjYtYzZlNi00ZDM4LWI3MmMtNTFmMjQ5NGM1ZTcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE1MzYxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ4YTFjZDFjMDMzNTcyNTFkZGUyMTJkNGI4MTVmNjEzMjRjMTgwZjIwZjEwOGQzZDg4MTM1NGZhNmMyYzI2N2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.x8YpeYnoXCEF0pFiSzv7-dB-ROpVd0xB_D1ylXqvnLs)
![3](https://private-user-images.githubusercontent.com/70063547/283703618-3edb4fdf-1b08-4a02-ab2a-6bdd7f532fb2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU2NzEsIm5iZiI6MTcyMzk5NTM3MSwicGF0aCI6Ii83MDA2MzU0Ny8yODM3MDM2MTgtM2VkYjRmZGYtMWIwOC00YTAyLWFiMmEtNmJkZDdmNTMyZmIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE1MzYxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThmNTRjMzM5MmE1ZjgyY2JiNzhmOGE1YmIyN2E5M2Y1YmU0NzVmZTU0ZTVmZDZmOGUyMDQ4YzdkYjczNzFjNjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.n_PJkIaeivPWail7Dz19Ut-wRhtJ4nDL8RV76Fx9zQE)
![4](https://private-user-images.githubusercontent.com/70063547/283703630-8c189de2-2169-4251-b115-0e39a52f3df8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU2NzEsIm5iZiI6MTcyMzk5NTM3MSwicGF0aCI6Ii83MDA2MzU0Ny8yODM3MDM2MzAtOGMxODlkZTItMjE2OS00MjUxLWIxMTUtMGUzOWE1MmYzZGY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