mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-16 05:36:04 +00:00
Print PR-Title into tooltip for actions (#35579)
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 <img width="290" height="88" alt="Screenshot 2025-10-03 231547" src="https://github.com/user-attachments/assets/dd8d264d-933f-4fb1-a945-82b172f95861" /> After <img width="301" height="91" alt="Screenshot 2025-10-03 224628" src="https://github.com/user-attachments/assets/74c9809a-c09a-4804-bb27-79058a99238b" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user