From 485d8f11212e590bf9f197b97151218f707f5016 Mon Sep 17 00:00:00 2001 From: NorthRealm <155140859+NorthRealm@users.noreply.github.com> Date: Mon, 23 Jun 2025 07:05:16 +0800 Subject: [PATCH] Add "Cancel workflow run" button to Actions list page (#34817) --- options/locale/locale_en-US.ini | 1 + routers/web/repo/actions/actions.go | 2 +- templates/repo/actions/runs_list.tmpl | 7 ++++++- templates/repo/actions/view_component.tmpl | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index dc50671335..78ffe1c618 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -3839,6 +3839,7 @@ runs.no_runs = The workflow has no runs yet. runs.empty_commit_message = (empty commit message) runs.expire_log_message = Logs have been purged because they were too old. runs.delete = Delete workflow run +runs.cancel = Cancel workflow run runs.delete.description = Are you sure you want to permanently delete this workflow run? This action cannot be undone. runs.not_done = This workflow run is not done. runs.view_workflow_file = View workflow file diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index 7f219811bd..202da407d2 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -318,7 +318,7 @@ func prepareWorkflowList(ctx *context.Context, workflows []Workflow) { ctx.Data["Page"] = pager ctx.Data["HasWorkflowsOrRuns"] = len(workflows) > 0 || len(runs) > 0 - ctx.Data["AllowDeleteWorkflowRuns"] = ctx.Repo.CanWrite(unit.TypeActions) + ctx.Data["CanWriteRepoUnitActions"] = ctx.Repo.CanWrite(unit.TypeActions) } // loadIsRefDeleted loads the IsRefDeleted field for each run in the list. diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl index fdb631f0ee..23df61a43c 100644 --- a/templates/repo/actions/runs_list.tmpl +++ b/templates/repo/actions/runs_list.tmpl @@ -40,7 +40,12 @@ {{svg "octicon-kebab-horizontal"}}