Skip to content
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

Add badge for Gitea Actions to display result in README.md #23688

Closed
lolo32 opened this issue Mar 24, 2023 · 2 comments · Fixed by #28102
Closed

Add badge for Gitea Actions to display result in README.md #23688

lolo32 opened this issue Mar 24, 2023 · 2 comments · Fixed by #28102
Labels
topic/gitea-actions related to the actions of Gitea type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@lolo32
Copy link

lolo32 commented Mar 24, 2023

Feature Description

Like it exists on GitHub or other CI, it could be interesting to add a SVG badge to integrate into markdown in example.

The documentation to use it on GitHub could be found https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge

An URL like https://<GITEA_INSTANCE>/<OWNER>/<REPOSITORY>/actions/workflows/<WORKFLOW_FILE>/badge.svg with:

  • GITEA_INSTANCE the domain/url of the Gate server
  • OWNER the project owner/organisation
  • REPOSITORY the repository name
  • WORLFLOW_FILE the filename of the action that trigged the build, and so, the result of the build

Screenshots

No response

@lolo32 lolo32 added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Mar 24, 2023
@a1012112796 a1012112796 added the topic/gitea-actions related to the actions of Gitea label Mar 25, 2023
@belliash

This comment was marked as duplicate.

@algernon
Copy link
Contributor

FWIW, I wrote a small bridge that does something like this: https://git.madhouse-project.org/algernon/ironforge/ (the README in there uses the service for the CI badge).

It's a separate server, and isn't as flexible as proposed here. It just looks at the most recent status, and redirects to an appropriate shields.io URL. It can't filter by workflow (the Gitea APIs don't provide that info yet), but it's close enough, and better than nothing.

silverwind pushed a commit that referenced this issue Feb 27, 2024
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:
```go
var statusColorMap = map[actions_model.Status]string{
	actions_model.StatusSuccess:   "#4c1",    // Green
	actions_model.StatusSkipped:   "#dfb317", // Yellow
	actions_model.StatusUnknown:   "#97ca00", // Light Green
	actions_model.StatusFailure:   "#e05d44", // Red
	actions_model.StatusCancelled: "#fe7d37", // Orange
	actions_model.StatusWaiting:   "#dfb317", // Yellow
	actions_model.StatusRunning:   "#dfb317", // Yellow
	actions_model.StatusBlocked:   "#dfb317", // Yellow
}
```
preview:

![1](https://github.com/go-gitea/gitea/assets/70063547/5465cbaf-23cd-4437-9848-2738c3cb8985)

![2](https://github.com/go-gitea/gitea/assets/70063547/ec393d26-c6e6-4d38-b72c-51f2494c5e71)

![3](https://github.com/go-gitea/gitea/assets/70063547/3edb4fdf-1b08-4a02-ab2a-6bdd7f532fb2)

![4](https://github.com/go-gitea/gitea/assets/70063547/8c189de2-2169-4251-b115-0e39a52f3df8)

![5](https://github.com/go-gitea/gitea/assets/70063547/3fe22c73-c2d7-4fec-9ea4-c501a1e4e3bd)

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: delvh <dev.lh@web.de>
@lunny lunny added this to the 1.22.0 milestone Feb 28, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/gitea-actions related to the actions of Gitea type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants