mirror of
https://github.com/go-gitea/gitea
synced 2025-07-24 19:28:38 +00:00
improve
This commit is contained in:
@@ -78,6 +78,10 @@ func newNotifyInput(repo *repo_model.Repository, doer *user_model.User, event we
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newNotifyInputForSchedules(repo *repo_model.Repository) *notifyInput {
|
||||||
|
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
|
||||||
@@ -485,7 +489,7 @@ func handleSchedules(
|
|||||||
RepoID: input.Repo.ID,
|
RepoID: input.Repo.ID,
|
||||||
OwnerID: input.Repo.OwnerID,
|
OwnerID: input.Repo.OwnerID,
|
||||||
WorkflowID: dwf.EntryName,
|
WorkflowID: dwf.EntryName,
|
||||||
TriggerUserID: input.Doer.ID,
|
TriggerUserID: user_model.ActionsUserID,
|
||||||
Ref: ref,
|
Ref: ref,
|
||||||
CommitSHA: commit.ID.String(),
|
CommitSHA: commit.ID.String(),
|
||||||
Event: input.Event,
|
Event: input.Event,
|
||||||
@@ -524,10 +528,5 @@ func DetectAndHandleSchedules(ctx context.Context, repo *repo_model.Repository)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need a notifyInput to call handleSchedules
|
return handleSchedules(ctx, scheduleWorkflows, commit, newNotifyInputForSchedules(repo), repo.DefaultBranch)
|
||||||
// if repo is a mirror, commit author maybe an external user,
|
|
||||||
// so we use action user as the Doer of the notifyInput
|
|
||||||
notifyInput := newNotifyInput(repo, user_model.NewActionsUser(), webhook_module.HookEventSchedule)
|
|
||||||
|
|
||||||
return handleSchedules(ctx, scheduleWorkflows, commit, notifyInput, repo.DefaultBranch)
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user