diff --git a/models/actions/run.go b/models/actions/run.go index f5ccba06c22b3..f1d85bbcd99bc 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 23df61a43c634..1e8ab4c16b037 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}}