Skip to content

Commit

Permalink
feat: add support for specifying reporter id when creating Jira issues (
Browse files Browse the repository at this point in the history
  • Loading branch information
parth-deepsource authored Oct 26, 2023
1 parent f0cf9a7 commit cff9ce8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions provider/jira/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,18 @@ type IssueType struct {
HierarchyLevel int `json:"hierarchyLevel"`
}

type Reporter struct {
ID string `json:"id,omitempty"`
}

type Fields struct {
Project struct {
Key string `json:"key"`
} `json:"project"`
IssueType struct {
ID string `json:"id"`
} `json:"issuetype"`
Reporter *Reporter `json:"reporter,omitempty"`
Summary string `json:"summary"`
Description map[string]interface{} `json:"description"`
}
Expand Down
11 changes: 9 additions & 2 deletions provider/jira/jira.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@ func (p *jiraSimple) Send(_ context.Context, notifier *domain.Notifier, body []b
return nil, err
}

reporter := (*Reporter)(nil)
if opts.ReporterID != "" {
reporter = &Reporter{ID: opts.ReporterID}
}

request := &CreateIssueRequest{
Fields: Fields{
Project: struct {
Key string "json:\"key\""
Key string `json:"key"`
}{Key: opts.ProjectKey},
IssueType: struct {
ID string "json:\"id\""
ID string `json:"id"`
}{ID: opts.IssueType},
Reporter: reporter,
Summary: payload.Summary,
Description: payload.Description,
},
Expand Down Expand Up @@ -225,6 +231,7 @@ type Opts struct {
ProjectKey string `mapstructure:"project_key"`
IssueType string `mapstructure:"issue_type"`
CloudID string `mapstructure:"cloud_id"`
ReporterID string `mapstructure:"reporter_id"`
}

func (o *Opts) Extract(c *domain.NotifierConfiguration) domain.IError {
Expand Down

0 comments on commit cff9ce8

Please sign in to comment.