From 0bc129481d7a1635c455ed54eb2240f05bbd835b Mon Sep 17 00:00:00 2001 From: da Kai Date: Thu, 9 Oct 2025 10:01:47 +0200 Subject: [PATCH] Print PR-Title into tooltip for actions (#35579) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR updates the tooltip for Pull-Request triggered runs to show the PR title instead of the PR number. --- I dont remember PR numbers, so having the title in the tooltip makes it much easier to recognize the right one 😊 Current Screenshot 2025-10-03 231547 After Screenshot 2025-10-03 224628 --------- Co-authored-by: wxiaoguang --- models/actions/run.go | 9 +++++++++ templates/repo/actions/runs_list.tmpl | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/models/actions/run.go b/models/actions/run.go index f5ccba06c2..f1d85bbcd9 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -102,6 +102,15 @@ func (run *ActionRun) PrettyRef() string { return refName.ShortName() } +// RefTooltip return a tooltop of run's ref. For pull request, it's the title of the PR, otherwise it's the ShortName. +func (run *ActionRun) RefTooltip() string { + payload, err := run.GetPullRequestEventPayload() + if err == nil && payload != nil && payload.PullRequest != nil { + return payload.PullRequest.Title + } + return git.RefName(run.Ref).ShortName() +} + // LoadAttributes load Repo TriggerUser if not loaded func (run *ActionRun) LoadAttributes(ctx context.Context) error { if run == nil { diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl index 23df61a43c..1e8ab4c16b 100644 --- a/templates/repo/actions/runs_list.tmpl +++ b/templates/repo/actions/runs_list.tmpl @@ -28,9 +28,9 @@
{{if $run.IsRefDeleted}} - {{$run.PrettyRef}} + {{$run.PrettyRef}} {{else}} - {{$run.PrettyRef}} + {{$run.PrettyRef}} {{end}}
{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}