mirror of
https://github.com/go-gitea/gitea.git
synced 2025-05-05 07:00:25 +02:00
Allow gitea bot as trigger user
This commit is contained in:
parent
110072a8d4
commit
f4bbd534b9
@ -49,8 +49,12 @@ func (runs RunList) LoadTriggerUser() error {
|
||||
return err
|
||||
}
|
||||
for _, run := range runs {
|
||||
if run.TriggerUserID == user_model.BotUserID {
|
||||
run.TriggerUser = user_model.NewBotUser()
|
||||
} else {
|
||||
run.TriggerUser = users[run.TriggerUserID]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -109,11 +109,15 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
}
|
||||
if opts.IsTag() { // If is tag reference
|
||||
if pusher == nil || pusher.ID != opts.PusherID {
|
||||
if opts.PusherID == user_model.BotUserID {
|
||||
pusher = user_model.NewBotUser()
|
||||
} else {
|
||||
var err error
|
||||
if pusher, err = user_model.GetUserByID(opts.PusherID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
tagName := opts.TagName()
|
||||
if opts.IsDelRef() {
|
||||
notification.NotifyPushCommits(
|
||||
@ -149,11 +153,15 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
}
|
||||
} else if opts.IsBranch() { // If is branch reference
|
||||
if pusher == nil || pusher.ID != opts.PusherID {
|
||||
if opts.PusherID == user_model.BotUserID {
|
||||
pusher = user_model.NewBotUser()
|
||||
} else {
|
||||
var err error
|
||||
if pusher, err = user_model.GetUserByID(opts.PusherID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
branch := opts.BranchName()
|
||||
if !opts.IsDelRef() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user