From 4da95b7cf7b51c0f704740efd16c1bdcf67ee5ba Mon Sep 17 00:00:00 2001
From: Giteabot <teabot@gitea.io>
Date: Tue, 21 Nov 2023 12:28:14 +0800
Subject: [PATCH] Fix empty action run title (#28113) (#28148)

Backport #28113 by @lunny

Fix #27901

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit c997e9073811fd91f101f3028a39c294c4958c37)
---
 options/locales/gitea_en-US.ini       | 1 +
 templates/repo/actions/runs_list.tmpl | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/options/locales/gitea_en-US.ini b/options/locales/gitea_en-US.ini
index f4efa2a097..6892fc0449 100644
--- a/options/locales/gitea_en-US.ini
+++ b/options/locales/gitea_en-US.ini
@@ -3558,6 +3558,7 @@ runs.actors_no_select = All actors
 runs.status_no_select = All status
 runs.no_results = No results matched.
 runs.no_runs = The workflow has no runs yet.
+runs.empty_commit_message = (empty commit message)
 
 workflow.disable = Disable Workflow
 workflow.disable_success = Workflow '%s' disabled successfully.
diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl
index b3469a2edc..3b289fb68f 100644
--- a/templates/repo/actions/runs_list.tmpl
+++ b/templates/repo/actions/runs_list.tmpl
@@ -12,7 +12,7 @@
 			</div>
 			<div class="flex-item-main">
 				<a class="flex-item-title" title="{{.Title}}" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
-					{{- .Title -}}
+					{{if .Title}}{{.Title}}{{else}}{{ctx.Locale.Tr "actions.runs.empty_commit_message"}}{{end}}
 				</a>
 				<div class="flex-item-body">
 					<b>{{if not $.CurWorkflow}}{{.WorkflowID}} {{end}}#{{.Index}}</b>: