2626import tempfile
2727import time
2828
29+ # 10101 is ID for New Feature issue type in Jira.
30+ JIRA_NEW_FEATURE_TYPE_ID = 10101
31+
2932
3033def handle_issue_opened (jira , event ):
3134 print ('Creating new JIRA issue for new GitHub issue' )
@@ -39,7 +42,7 @@ def handle_issue_edited(jira, event):
3942 fields = {
4043 "description" : _get_description (gh_issue ),
4144 "summary" : _get_summary (gh_issue ),
42- }
45+ }
4346
4447 _update_components_field (jira , fields , issue )
4548
@@ -137,6 +140,7 @@ def handle_comment_deleted(jira, event):
137140 jira_issue = _find_jira_issue (jira , event ["issue" ], True )
138141 jira .add_comment (jira_issue .id , "@%s deleted [GitHub issue comment|%s]" % (gh_comment ["user" ]["login" ], gh_comment ["html_url" ]))
139142
143+
140144def _check_issue_label (label ):
141145 """
142146 Ignore labels that start with "Status:" and "Resolution:". These labels are
@@ -145,9 +149,10 @@ def _check_issue_label(label):
145149 ignore_prefix = ("status:" , "resolution:" )
146150 if label .lower ().startswith (ignore_prefix ):
147151 return None
148-
152+
149153 return label
150154
155+
151156def _update_link_resolved (jira , gh_issue , jira_issue ):
152157 """
153158 Update the 'resolved' status of the remote "synced from" link, based on the
@@ -339,12 +344,12 @@ def _update_components_field(jira, fields, existing_issue=None):
339344
340345 print ("Setting components field" )
341346
342- fields ["components" ] = [{"name" : component }]
347+ fields ["components" ] = [{"name" : component }]
343348 # keep any existing components as well
344349 if existing_issue :
345350 for component in existing_issue .fields .components :
346351 if component .name != component :
347- fields ["components" ].append ({"name" : component .name })
352+ fields ["components" ].append ({"name" : component .name })
348353
349354
350355def _get_jira_issue_type (jira , gh_issue ):
@@ -360,6 +365,10 @@ def _get_jira_issue_type(jira, gh_issue):
360365 issue_types = jira .issue_types ()
361366
362367 for gh_label in gh_labels :
368+ # Type: Feature Request label should match New Feature issue type in Jira
369+ if gh_label == 'Type: Feature Request' :
370+ print ('GitHub label is \' Type: Feature Request\' . Mapping to New Feature Jira issue type' )
371+ return {"id" : JIRA_NEW_FEATURE_TYPE_ID } # JIRA API needs JSON here
363372 for issue_type in issue_types :
364373 type_name = issue_type .name .lower ()
365374 if gh_label .lower () in [type_name , "type: %s" % (type_name ,)]:
0 commit comments