Skip to content

Commit ea48cfb

Browse files
aahlenstMathieu Fenniak
authored andcommitted
chore: remove run recovery notifications (#13883)
Remove the capability to trigger notifications including webhooks when a Forgejo Actions workflow run recovered. That functionality was added in https://codeberg.org/forgejo/forgejo/pulls/7509 but disabled in https://codeberg.org/forgejo/forgejo/pulls/8374 (Forgejo 12) because [it compared unrelated workflow runs](https://codeberg.org/forgejo/forgejo/issues/8373). It has never been repaired. According to https://codeberg.org/forgejo/user-research/issues/63, interest for that capability is somewhere between inexistent and low. It is also not easy to express what "recovered" is supposed to mean when automatic cancellation and run reordering comes into play. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13883 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
1 parent 79a94d6 commit ea48cfb

26 files changed

Lines changed: 50 additions & 284 deletions

File tree

models/actions/run.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,6 @@ func GetLatestRun(ctx context.Context, repoID int64) (*ActionRun, error) {
483483
return &run, nil
484484
}
485485

486-
func GetRunBefore(ctx context.Context, _ *ActionRun) (*ActionRun, error) {
487-
// TODO return the most recent run related to the run given in argument
488-
// see https://codeberg.org/forgejo/user-research/issues/63 for context
489-
return nil, util.ErrNotExist
490-
}
491-
492486
func GetLatestRunForBranchAndWorkflow(ctx context.Context, repoID int64, branch, workflowFile, event string) (*ActionRun, error) {
493487
var run ActionRun
494488
q := db.GetEngine(ctx).Where("repo_id=?", repoID).And("workflow_id=?", workflowFile)

models/webhook/webhook.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,6 @@ func (w *Webhook) HasActionRunFailureEvent() bool {
304304
(w.ChooseEvents && w.ActionRunFailure)
305305
}
306306

307-
// HasActionRunRecoverEvent returns if hook enabled action recover event.
308-
func (w *Webhook) HasActionRunRecoverEvent() bool {
309-
return w.SendEverything ||
310-
(w.ChooseEvents && w.ActionRunRecover)
311-
}
312-
313307
// HasActionRunSuccessEvent returns if hook enabled action success event.
314308
func (w *Webhook) HasActionRunSuccessEvent() bool {
315309
return w.SendEverything ||
@@ -355,7 +349,6 @@ func (w *Webhook) EventCheckers() []struct {
355349
{w.HasPackageEvent, webhook_module.HookEventPackage},
356350
{w.HasPullRequestReviewRequestEvent, webhook_module.HookEventPullRequestReviewRequest},
357351
{w.HasActionRunFailureEvent, webhook_module.HookEventActionRunFailure},
358-
{w.HasActionRunRecoverEvent, webhook_module.HookEventActionRunRecover},
359352
{w.HasActionRunSuccessEvent, webhook_module.HookEventActionRunSuccess},
360353
}
361354
}

models/webhook/webhook_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ func TestWebhook_EventsArray(t *testing.T) {
7474
"pull_request", "pull_request_assign", "pull_request_label", "pull_request_milestone",
7575
"pull_request_comment", "pull_request_review_approved", "pull_request_review_rejected",
7676
"pull_request_review_comment", "pull_request_sync", "wiki", "repository", "release",
77-
"package", "pull_request_review_request", "action_run_failure",
78-
"action_run_recover", "action_run_success",
77+
"package", "pull_request_review_request", "action_run_failure", "action_run_success",
7978
},
8079
(&Webhook{
8180
HookEvent: &webhook_module.HookEvent{SendEverything: true},
@@ -157,7 +156,6 @@ func TestCreateWebhook(t *testing.T) {
157156
// string(webhook_module.HookEventSchedule),
158157
// string(webhook_module.HookEventWorkflowDispatch),
159158
string(webhook_module.HookEventActionRunFailure),
160-
string(webhook_module.HookEventActionRunRecover),
161159
string(webhook_module.HookEventActionRunSuccess),
162160
},
163161
hookFromDb.EventsArray())

modules/structs/hook.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,6 @@ type ActionPayload struct {
508508
// the status of this run before it completed
509509
// this must be a not done status
510510
PriorStatus string `json:"prior_status"`
511-
// the last run for the same workflow
512-
// could be nil when Run is the first for it's workflow
513-
LastRun *ActionRun `json:"last_run,omitempty"`
514511
}
515512

516513
// JSONPayload return payload information

modules/webhook/structs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type HookEvents struct {
2828
Release bool `json:"release"`
2929
Package bool `json:"package"`
3030
ActionRunFailure bool `json:"action_run_failure"`
31-
ActionRunRecover bool `json:"action_run_recover"`
3231
ActionRunSuccess bool `json:"action_run_success"`
3332
}
3433

modules/webhook/type.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ func (h HookEventType) Event() string {
7171
return "release"
7272
case HookEventActionRunFailure:
7373
return "action_run_failure"
74-
case HookEventActionRunRecover:
75-
return "action_run_recover"
7674
case HookEventActionRunSuccess:
7775
return "action_run_success"
7876
}

options/locale/locale_en-US.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,8 +2379,6 @@ settings.event_pull_request_enforcement = Enforcement
23792379
settings.event_header_action = Action Run events
23802380
settings.event_action_failure = Failure
23812381
settings.event_action_failure_desc = Action Run ended as failure.
2382-
settings.event_action_recover = Recover
2383-
settings.event_action_recover_desc = Action Run succeeded after last Action Run in the same workflow failed.
23842382
settings.event_action_success = Success
23852383
settings.event_action_success_desc = Action Run succeeded.
23862384
settings.event_package = Package

routers/api/v1/utils/hook.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, ownerID, repoI
212212
Release: util.SliceContainsString(form.Events, string(webhook_module.HookEventRelease), true),
213213
Package: util.SliceContainsString(form.Events, string(webhook_module.HookEventPackage), true),
214214
ActionRunFailure: util.SliceContainsString(form.Events, string(webhook_module.HookEventActionRunFailure), true),
215-
ActionRunRecover: util.SliceContainsString(form.Events, string(webhook_module.HookEventActionRunRecover), true),
216215
ActionRunSuccess: util.SliceContainsString(form.Events, string(webhook_module.HookEventActionRunSuccess), true),
217216
},
218217
BranchFilter: form.BranchFilter,

routers/api/v1/utils/hook_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ func TestHookEventInclusion(t *testing.T) {
113113
string(webhook_module.HookEventRelease),
114114
string(webhook_module.HookEventPackage),
115115
string(webhook_module.HookEventActionRunFailure),
116-
string(webhook_module.HookEventActionRunRecover),
117116
string(webhook_module.HookEventActionRunSuccess),
118117
},
119118
}

routers/web/repo/setting/webhook.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ func ParseHookEvent(form forms.WebhookCoreForm) *webhook_module.HookEvent {
176176
Repository: form.Repository,
177177
Package: form.Package,
178178
ActionRunFailure: form.ActionFailure,
179-
ActionRunRecover: form.ActionRecover,
180179
ActionRunSuccess: form.ActionSuccess,
181180
},
182181
BranchFilter: form.BranchFilter,

0 commit comments

Comments
 (0)