enhance(actions): set descriptive browser tab title on run view (#37870)

This commit is contained in:
Nicolas
2026-05-28 07:51:45 +02:00
committed by GitHub
parent 9e0e9e45ac
commit db04bcb31a

View File

@@ -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.