Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mohaijiang committed Mar 11, 2024
1 parent 335fde4 commit db10ce7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/service/project.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package service

import (
"context"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -127,6 +128,19 @@ func (p *ProjectService) GetProjects(userId int, keyword string, page, size, pro
}
data.RecentBuild = recentBuild
data.RecentCheck = recentCheck
githubService := application.GetBean[*GithubService]("githubService")
ctx, _ := context.WithTimeout(context.Background(), time.Second*20)
owner, repo, err := ParsingGitHubURL(project.RepositoryUrl)
if err != nil {
branches, err2 := githubService.ListRepositoryBranch(ctx, owner, repo)
if err2 != nil {
data.AllBranch = []string{data.Branch}
}
data.AllBranch = branches
} else {
data.AllBranch = []string{data.Branch}
}

projectList = append(projectList, data)
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/vo/project_vo.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type ProjectListVo struct {
RecentCheck RecentCheckVo `json:"recentCheck"`
RecentBuild RecentBuildVo `json:"recentBuild"`
RecentDeploy interface{} `json:"recentDeploy"`
AllBranch []string `json:"allBranch"`
}

type ProjectDetailVo struct {
Expand Down

0 comments on commit db10ce7

Please sign in to comment.