1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-16 07:18:37 +00:00

revert revert some changes

This commit is contained in:
yp05327
2024-04-19 07:40:46 +00:00
parent a9875e7442
commit dc01fcae62

View File

@@ -78,6 +78,11 @@ func newNotifyInput(repo *repo_model.Repository, doer *user_model.User, event we
} }
} }
func newNotifyInputForSchedules(repo *repo_model.Repository) *notifyInput {
// the doer here will be ignored as we force using action user when handling schedules
return newNotifyInput(repo, user_model.NewActionsUser(), webhook_module.HookEventSchedule)
}
func (input *notifyInput) WithDoer(doer *user_model.User) *notifyInput { func (input *notifyInput) WithDoer(doer *user_model.User) *notifyInput {
input.Doer = doer input.Doer = doer
return input return input
@@ -525,7 +530,9 @@ func DetectAndHandleSchedules(ctx context.Context, repo *repo_model.Repository)
} }
// We need a notifyInput to call handleSchedules // We need a notifyInput to call handleSchedules
notifyInput := newNotifyInput(repo, user_model.NewActionsUser(), webhook_module.HookEventSchedule) // if repo is a mirror, commit author maybe an external user,
// so we use action user as the Doer of the notifyInput
notifyInput := newNotifyInputForSchedules(repo)
return handleSchedules(ctx, scheduleWorkflows, commit, notifyInput, repo.DefaultBranch) return handleSchedules(ctx, scheduleWorkflows, commit, notifyInput, repo.DefaultBranch)
} }