Skip to content

Commit 8e0c4e4

Browse files
authored
Fix mapping of Type: Feature Request to New Feature issue type in Jira (espressif#32)
* Fix mapping of Type: Feature Request to New Feature in Jira * Add constant for New Feature issue type
1 parent fa087bd commit 8e0c4e4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

sync_issues_to_jira/sync_issue.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import tempfile
2727
import time
2828

29+
# 10101 is ID for New Feature issue type in Jira.
30+
JIRA_NEW_FEATURE_TYPE_ID = 10101
31+
2932

3033
def 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+
140144
def _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+
151156
def _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

350355
def _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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy