@@ -25,12 +25,17 @@ type RequireAction struct {
2525 OrgID int64 `xorm:"index"`
2626 RepoID int64 `xorm:"index"`
2727 Name string `xorm:"UNIQUE(owner_repo_name) NOT NULL"`
28- Data string `xorm:"LONGTEXT NOT NULL"`
28+ Description string `xorm:"LONGTEXT NOT NULL"`
2929 CreatedUnix timeutil.TimeStamp `xorm:"created NOT NULL"`
3030 UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
3131 RepoRange string // glob match which repositories could use this runner
3232}
3333
34+ type GlobalWorkflow struct {
35+ RepoName string
36+ Filename string
37+ }
38+
3439func init () {
3540 db .RegisterModel (new (RequireAction ))
3641}
@@ -58,33 +63,3 @@ func (r *RequireAction) LoadAttributes(ctx context.Context) error {
5863 return nil
5964}
6065
61- func ListAvailableWorkflows (ctx context.Context , orgID int64 ) ([]* RequireAction , error ) {
62- requireActionList := []* RequireAction {}
63- /*
64- orgRepos, err := org_model.GetOrgRepositories(ctx, orgID)
65- if err != nil {
66- return nil, fmt.Errorf("ListAvailableWorkflows get org repos: %w", err)
67- }
68- for _, repo := range orgRepos {
69- repo.LoadUnits(ctx)
70- actionsConfig := repo.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
71- enabledWorkflows := actionsConfig.GetGlobalWorkflow()
72- for _, workflow := range enabledWorkflows {
73- requireAction := &RequireAction{
74- OrgID: orgID,
75- RepoID: repo.ID,
76- Repo: repo,
77- Data: workflow,
78- Link: repo.APIURL(),
79- }
80- requireActionList = append(requireActionList, requireAction)
81- }
82- }
83- for _, require_action := range requireActionList {
84- if err := require_action.Validate(); err != nil {
85- return requireActionList, err
86- }
87- }
88- */
89- return requireActionList , nil
90- }
0 commit comments