diff options
author | yp05327 <576951401@qq.com> | 2024-04-11 16:11:32 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-11 15:11:32 +0800 |
commit | 96d31fe0a8b88c09488989cd5459d4124dcb7983 (patch) | |
tree | 9ac2ec35016d3540b318869bf632fda3e83c65a6 /models | |
parent | f3cc00626b5a170e193961b885d4e60088ef7d9b (diff) | |
download | gitea-96d31fe0a8b88c09488989cd5459d4124dcb7983.tar.gz gitea-96d31fe0a8b88c09488989cd5459d4124dcb7983.zip |
Avoid user does not exist error when detecting schedule actions when the commit author is an external user (#30357)
![image](https://github.com/go-gitea/gitea/assets/18380374/ddf6ee84-2242-49b9-b066-bd8429ba4d76)
When repo is a mirror, and commit author is an external user, then
`GetUserByEmail` will return error.
reproduce/test:
- mirror Gitea to your instance
- disable action and enable it again, this will trigger
`DetectAndHandleSchedules`
ps: also follow #24706, it only fixed normal runs, not scheduled runs.
Diffstat (limited to 'models')
-rw-r--r-- | models/actions/schedule_list.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/models/actions/schedule_list.go b/models/actions/schedule_list.go index 1d35adc420..5361b94801 100644 --- a/models/actions/schedule_list.go +++ b/models/actions/schedule_list.go @@ -40,6 +40,9 @@ func (schedules ScheduleList) LoadTriggerUser(ctx context.Context) error { schedule.TriggerUser = user_model.NewActionsUser() } else { schedule.TriggerUser = users[schedule.TriggerUserID] + if schedule.TriggerUser == nil { + schedule.TriggerUser = user_model.NewGhostUser() + } } } return nil |