mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-14 14:57:21 +00:00
fix: disable Forgejo Actions email notifications on recovery (#8374)
- Make the migration to add an index a noop - do not remove it as it would break v12.next & v13.next - Keep the logic that relies on finding the last run, only always fail to find which is the same as assuming each run is one of a kind Refs forgejo/forgejo#8373 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8374 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
bcde3aea4f
commit
c0eeb75322
6 changed files with 10 additions and 144 deletions
|
@ -284,16 +284,10 @@ func GetLatestRun(ctx context.Context, repoID int64) (*ActionRun, error) {
|
|||
return &run, nil
|
||||
}
|
||||
|
||||
// GetRunBefore returns the last run that completed a given timestamp (not inclusive).
|
||||
func GetRunBefore(ctx context.Context, repoID int64, timestamp timeutil.TimeStamp) (*ActionRun, error) {
|
||||
var run ActionRun
|
||||
has, err := db.GetEngine(ctx).Where("repo_id=? AND stopped IS NOT NULL AND stopped<?", repoID, timestamp).OrderBy("stopped DESC").Limit(1).Get(&run)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, fmt.Errorf("run before: %w", util.ErrNotExist)
|
||||
}
|
||||
return &run, nil
|
||||
func GetRunBefore(ctx context.Context, _ *ActionRun) (*ActionRun, error) {
|
||||
// TODO return the most recent run related to the run given in argument
|
||||
// see https://codeberg.org/forgejo/user-research/issues/63 for context
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func GetLatestRunForBranchAndWorkflow(ctx context.Context, repoID int64, branch, workflowFile, event string) (*ActionRun, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue