From daa161ca9bf3887cf4caf6fa7a6ce5f2940a67c8 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 30 Oct 2025 16:15:11 +0100 Subject: [PATCH] chore: remove the approve endpoint for runs It will be replaced with a link to the trust panel in the pull request. --- routers/web/repo/actions/view.go | 36 -------------------------------- routers/web/web.go | 1 - 2 files changed, 37 deletions(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 95f383b9a6..55999702d2 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -680,42 +680,6 @@ func Cancel(ctx *context_module.Context) { ctx.JSON(http.StatusOK, struct{}{}) } -func Approve(ctx *context_module.Context) { - runIndex := ctx.ParamsInt64("run") - - current, jobs := getRunJobs(ctx, runIndex, -1) - if ctx.Written() { - return - } - run := current.Run - doer := ctx.Doer - - if err := db.WithTx(ctx, func(ctx context.Context) error { - run.NeedApproval = false - run.ApprovedBy = doer.ID - if err := actions_service.UpdateRun(ctx, run, "need_approval", "approved_by"); err != nil { - return err - } - for _, job := range jobs { - if len(job.Needs) == 0 && job.Status.IsBlocked() { - job.Status = actions_model.StatusWaiting - _, err := actions_service.UpdateRunJob(ctx, job, nil, "status") - if err != nil { - return err - } - } - } - return nil - }); err != nil { - ctx.Error(http.StatusInternalServerError, err.Error()) - return - } - - actions_service.CreateCommitStatus(ctx, jobs...) - - ctx.JSON(http.StatusOK, struct{}{}) -} - // getRunJobs gets the jobs of runIndex, and returns jobs[jobIndex], jobs. // Any error will be written to the ctx. // It never returns a nil job of an empty jobs, if the jobIndex is out of range, it will be treated as 0. diff --git a/routers/web/web.go b/routers/web/web.go index 8d1a886554..fb0306e6d2 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1458,7 +1458,6 @@ func registerRoutes(m *web.Route) { Post(web.Bind(actions.ViewRequest{}), actions.ViewPost) }) m.Post("/cancel", reqRepoActionsWriter, actions.Cancel) - m.Post("/approve", reqRepoActionsWriter, actions.Approve) m.Get("/artifacts", actions.ArtifactsView) m.Get("/artifacts/{artifact_name_or_id}", actions.ArtifactsDownloadView) m.Delete("/artifacts/{artifact_name}", reqRepoActionsWriter, actions.ArtifactsDeleteView)