@@ -13,9 +13,8 @@ import (
1313 "code.gitea.io/gitea/modules/log"
1414 "code.gitea.io/gitea/modules/web"
1515 actions_service "code.gitea.io/gitea/services/actions"
16- "code.gitea.io/gitea/services/forms"
17-
1816 "code.gitea.io/gitea/services/context"
17+ "code.gitea.io/gitea/services/forms"
1918)
2019
2120// SetRequireActionDeletePost response for deleting a require action workflow
@@ -62,8 +61,6 @@ func GlobalEnableWorkflow(ctx *context.Context, orgID int64) {
6261func CreateRequireAction (ctx * context.Context , orgID int64 , redirectURL string ) {
6362 ctx .Data ["OrgID" ] = ctx .Org .Organization .ID
6463 form := web .GetForm (ctx ).(* forms.RequireActionForm )
65- // log.Error("org %d, repo_name: %s, workflow_name %s", orgID, form.RepoName, form.WorkflowName)
66- log .Error ("org %d, repo_name: %+v" , orgID , form )
6764 v , err := actions_service .CreateRequireAction (ctx , orgID , form .RepoName , form .WorkflowName )
6865 if err != nil {
6966 log .Error ("CreateRequireAction: %v" , err )
@@ -73,3 +70,15 @@ func CreateRequireAction(ctx *context.Context, orgID int64, redirectURL string)
7370 ctx .Flash .Success (ctx .Tr ("actions.require_action.creation.success" , v .WorkflowName ))
7471 ctx .JSONRedirect (redirectURL )
7572}
73+
74+ func DeleteRequireAction (ctx * context.Context , redirectURL string ) {
75+ id := ctx .ParamsInt64 (":require_action_id" )
76+
77+ if err := actions_service .DeleteRequireActionByID (ctx , id ); err != nil {
78+ log .Error ("Delete RequireAction [%d] failed: %v" , id , err )
79+ ctx .JSONError (ctx .Tr ("actions.require_action.deletion.failed" ))
80+ return
81+ }
82+ ctx .Flash .Success (ctx .Tr ("actions.require_action.deletion.success" ))
83+ ctx .JSONRedirect (redirectURL )
84+ }
0 commit comments