mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-28 15:55:26 +00:00
enhance(actions): set descriptive browser tab title on run view (#37870)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
actions_model "gitea.dev/models/actions"
|
||||
@@ -206,6 +207,16 @@ func View(ctx *context_module.Context) {
|
||||
jobID := ctx.PathParamInt64("job")
|
||||
ctx.Data["JobID"] = jobID // it can be 0 when no job (e.g.: run summary view)
|
||||
|
||||
// Browser tab title, ordered most-specific → least-specific so narrow tabs keep the useful part.
|
||||
// Separator matches the " - " used by head.tmpl when joining to PageTitleCommon.
|
||||
titleParts := []string{run.Title, run.WorkflowID}
|
||||
if jobID > 0 {
|
||||
if job, err := actions_model.GetRunJobByRunAndID(ctx, run.ID, jobID); err == nil && job.Name != "" {
|
||||
titleParts = append([]string{job.Name}, titleParts...)
|
||||
}
|
||||
}
|
||||
ctx.Data["Title"] = strings.Join(titleParts, " - ")
|
||||
|
||||
attemptNum := ctx.PathParamInt64("attempt")
|
||||
|
||||
// ActionsViewURL is the endpoint for viewing a run (job summary), a job, or a job attempt.
|
||||
|
||||
Reference in New Issue
Block a user