diff --git a/src/gitee-utils/client.go b/src/gitee-utils/client.go index 45950b4..d2471b0 100644 --- a/src/gitee-utils/client.go +++ b/src/gitee-utils/client.go @@ -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) diff --git a/src/server.go b/src/server.go index 965fe51..7c12d26 100644 --- a/src/server.go +++ b/src/server.go @@ -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")) } @@ -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 @@ -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{