fix(actions): skip already-approved runs in ApproveRuns (#38653)

The handler of `/actions/runs/{run}/approve` doesn't check if the run is
already approved. If a run is re-approved, its jobs' status will be
reset to `StatusWaiting`, causing incorrect job status.
This commit is contained in:
Zettat123
2026-07-27 06:01:46 +00:00
committed by GitHub
parent cebdc90ed9
commit 528b1f211b
2 changed files with 70 additions and 0 deletions
+3
View File
@@ -28,6 +28,9 @@ func ApproveRuns(ctx context.Context, repo *repo_model.Repository, doer *user_mo
if err != nil {
return err
}
if !run.NeedApproval {
continue
}
run.NeedApproval = false
run.ApprovedBy = doer.ID
if err := actions_model.UpdateRun(ctx, run, "need_approval", "approved_by"); err != nil {