@@ -11,6 +11,7 @@ import (
11
11
12
12
auth_model "code.gitea.io/gitea/models/auth"
13
13
"code.gitea.io/gitea/models/db"
14
+ repo_model "code.gitea.io/gitea/models/repo"
14
15
"code.gitea.io/gitea/models/unit"
15
16
"code.gitea.io/gitea/modules/container"
16
17
"code.gitea.io/gitea/modules/log"
@@ -37,9 +38,10 @@ type ActionTask struct {
37
38
Started timeutil.TimeStamp `xorm:"index"`
38
39
Stopped timeutil.TimeStamp `xorm:"index(stopped_log_expired)"`
39
40
40
- RepoID int64 `xorm:"index"`
41
- OwnerID int64 `xorm:"index"`
42
- CommitSHA string `xorm:"index"`
41
+ RepoID int64 `xorm:"index"`
42
+ Repo * repo_model.Repository `xorm:"-"`
43
+ OwnerID int64 `xorm:"index"`
44
+ CommitSHA string `xorm:"index"`
43
45
IsForkPullRequest bool
44
46
45
47
Token string `xorm:"-"`
@@ -151,6 +153,14 @@ func (task *ActionTask) GenerateToken() (err error) {
151
153
return err
152
154
}
153
155
156
+ func (task * ActionTask ) LoadRepository (ctx context.Context ) (err error ) {
157
+ if task .Repo != nil {
158
+ return nil
159
+ }
160
+ task .Repo , err = repo_model .GetRepositoryByID (ctx , task .RepoID )
161
+ return
162
+ }
163
+
154
164
func GetTaskByID (ctx context.Context , id int64 ) (* ActionTask , error ) {
155
165
var task ActionTask
156
166
has , err := db .GetEngine (ctx ).Where ("id=?" , id ).Get (& task )
0 commit comments