Skip to content

Commit

Permalink
!26 fix repoinfo
Browse files Browse the repository at this point in the history
Merge pull request !26 from Clement Li/masterone
  • Loading branch information
li-clement authored and gitee-org committed Jan 6, 2022
2 parents e49e1a9 + 963c300 commit 736e6ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
25 changes: 16 additions & 9 deletions src/gitee-utils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@ type User struct {
IsOrgUser int `json:"isOrgUser"`
}

type RepoInfo struct {
Org string `json:"org"`
Repo string `json:"repo"`
Ent string `json:"ent"`
}

type Issue struct {
IssueID string `json:"issueID"`
IssueAction string `json:"issueAction"`
IssueUser User `json:"issueUser"`
IssueTime string `json:"issueTime"`
IssueUpdateTime string `json:"issueUpdateTime"`
IssueAssignee string `json:"issueAssignee"`
IssueLabel []Label `json:"issueLabel"`
IssueTitle string `json:"issueTitle"`
IssueContent string `json:"issueContent"`
IssueID string `json:"issueID"`
IssueAction string `json:"issueAction"`
IssueUser User `json:"issueUser"`
IssueTime string `json:"issueTime"`
IssueUpdateTime string `json:"issueUpdateTime"`
IssueAssignee string `json:"issueAssignee"`
IssueLabel []Label `json:"issueLabel"`
IssueTitle string `json:"issueTitle"`
IssueContent string `json:"issueContent"`
RepoInfo RepoInfo `json:"repoInfo"`
}

var _ Client = (*client)(nil)
Expand Down
9 changes: 2 additions & 7 deletions src/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ import (

var repo []byte

type RepoInfo struct {
Org string `json:"org"`
Repo string `json:"repo"`
Ent string `json:"ent"`
}

func getToken() []byte {
return []byte(os.Getenv("gitee_token"))
}
Expand Down Expand Up @@ -73,7 +67,7 @@ func handleIssueEvent(i *gitee.IssueEvent) error {
return nil
}
var issue gitee_utils.Issue
var repoinfo RepoInfo
var repoinfo gitee_utils.RepoInfo
var strEnt string
repoinfo.Org = i.Repository.Namespace
repoinfo.Repo = i.Repository.Name
Expand All @@ -95,6 +89,7 @@ func handleIssueEvent(i *gitee.IssueEvent) error {
issue.IssueUpdateTime = i.Issue.UpdatedAt.Format(time.RFC3339)
issue.IssueTitle = i.Issue.Title
issue.IssueContent = i.Issue.Body
issue.RepoInfo = repoinfo

if i.Issue.Number == "I1EL99" {
gitee_utils.LogInstance.WithFields(logrus.Fields{
Expand Down

0 comments on commit 736e6ec

Please sign in to comment.