mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
[GITEA] allow viewing the latest Action Run on the web
Similar to how some other parts of the web UI support a `/latest` path to directly go to the latest of a certain thing, let the Actions web UI do the same: `/{owner}/{repo}/actions/runs/latest` will redirect to the latest run, if there's one available. Fixes gitea#27991. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu> (cherry picked from commitf67ccef1dd
) Code cleanup in the actions.ViewLatest route handler Based on feedback received after the feature was merged, use `ctx.NotFound` and `ctx.ServerError`, and drop the use of the unnecessary `ctx.Written()`. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu> (cherry picked from commit74e42da563
) (cherry picked from commitf7535a1cef
) (cherry picked from commit1a90cd37c3
) (cherry picked from commitd86d71340a
) (cherry picked from commit9e5cce1afc
) (cherry picked from commit2013fb3fab
) (cherry picked from commit88b9d21d11
) (cherry picked from commit72c020298e
) (cherry picked from commit6525f730df
)
This commit is contained in:
parent
533c87da65
commit
fa0759962b
4 changed files with 130 additions and 11 deletions
|
@ -46,6 +46,20 @@ func View(ctx *context_module.Context) {
|
|||
ctx.HTML(http.StatusOK, tplViewActions)
|
||||
}
|
||||
|
||||
func ViewLatest(ctx *context_module.Context) {
|
||||
run, err := actions_model.GetLatestRun(ctx, ctx.Repo.Repository.ID)
|
||||
if err != nil {
|
||||
ctx.NotFound("GetLatestRun", err)
|
||||
return
|
||||
}
|
||||
err = run.LoadAttributes(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("LoadAttributes", err)
|
||||
return
|
||||
}
|
||||
ctx.Redirect(run.HTMLURL(), http.StatusTemporaryRedirect)
|
||||
}
|
||||
|
||||
type ViewRequest struct {
|
||||
LogCursors []struct {
|
||||
Step int `json:"step"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue