mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-29 05:06:11 +01:00
parent
4e98224a45
commit
83186eca80
|
@ -374,11 +374,6 @@ func handleSchedules(
|
||||||
commit *git.Commit,
|
commit *git.Commit,
|
||||||
input *notifyInput,
|
input *notifyInput,
|
||||||
) error {
|
) error {
|
||||||
if len(detectedWorkflows) == 0 {
|
|
||||||
log.Trace("repo %s with commit %s couldn't find schedules", input.Repo.RepoPath(), commit.ID)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
branch, err := commit.GetBranchName()
|
branch, err := commit.GetBranchName()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -388,18 +383,20 @@ func handleSchedules(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
rows, _, err := actions_model.FindSchedules(ctx, actions_model.FindScheduleOptions{RepoID: input.Repo.ID})
|
if count, err := actions_model.CountSchedules(ctx, actions_model.FindScheduleOptions{RepoID: input.Repo.ID}); err != nil {
|
||||||
if err != nil {
|
log.Error("CountSchedules: %v", err)
|
||||||
log.Error("FindCrons: %v", err)
|
|
||||||
return err
|
return err
|
||||||
}
|
} else if count > 0 {
|
||||||
|
|
||||||
if len(rows) > 0 {
|
|
||||||
if err := actions_model.DeleteScheduleTaskByRepo(ctx, input.Repo.ID); err != nil {
|
if err := actions_model.DeleteScheduleTaskByRepo(ctx, input.Repo.ID); err != nil {
|
||||||
log.Error("DeleteCronTaskByRepo: %v", err)
|
log.Error("DeleteCronTaskByRepo: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(detectedWorkflows) == 0 {
|
||||||
|
log.Trace("repo %s with commit %s couldn't find schedules", input.Repo.RepoPath(), commit.ID)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
p, err := json.Marshal(input.Payload)
|
p, err := json.Marshal(input.Payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("json.Marshal: %w", err)
|
return fmt.Errorf("json.Marshal: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue