61: map Jira priority to legacy-jira-priority, and include votes in the 'Legacy Jira Information' header when it's > 0 (#76)
diff --git a/migration/src/jira2github_import.py b/migration/src/jira2github_import.py
index eefc59e..eaea420 100644
--- a/migration/src/jira2github_import.py
+++ b/migration/src/jira2github_import.py
@@ -58,7 +58,9 @@
pull_requests = extract_pull_requests(o)
jira_labels = extract_labels(o)
resolution = extract_resolution(o)
-
+ priority = extract_priority(o)
+ vote_count = extract_vote_count(o)
+
reporter_gh = account_map.get(reporter_name)
reporter = f"{reporter_dispname} (@{reporter_gh})" if reporter_gh else f"{reporter_dispname}"
assignee_gh = account_map.get(assignee_name)
@@ -103,6 +105,11 @@
[{jira_id}]({jira_issue_url(jira_id)}) by {reporter} on {created_datetime.strftime('%b %d %Y')}"""
+ if vote_count:
+ body += f", {vote_count} vote"
+ if vote_count > 1:
+ body += 's'
+
if resolutiondate_datetime is not None:
body += f", resolved {resolutiondate_datetime.strftime('%b %d %Y')}"
elif created_datetime.date() != updated_datetime.date():
@@ -195,6 +202,8 @@
labels.append(f"legacy-jira-label:{label}")
if resolution:
labels.append(f"legacy-jira-resolution:{resolution}")
+ if priority:
+ labels.append(f"legacy-jira-priority:{priority}")
data = {
"issue": {
diff --git a/migration/src/jira_util.py b/migration/src/jira_util.py
index 89841e1..551f777 100644
--- a/migration/src/jira_util.py
+++ b/migration/src/jira_util.py
@@ -53,6 +53,22 @@
return None
+def extract_priority(o: dict) -> Optional[str]:
+ priority = o.get("fields").get("priority")
+ if priority:
+ return priority.get("name")
+ return None
+
+
+def extract_vote_count(o: dict) -> Optional[str]:
+ votes = o.get("fields").get("votes")
+ if votes:
+ vote_count = votes.get("votes")
+ if vote_count > 0:
+ return vote_count
+ return None
+
+
def extract_reporter(o: dict) -> tuple[str, str]:
reporter = o.get("fields").get("reporter")
name = reporter.get("name", "") if reporter else ""