dianaclarke commented on a change in pull request #9598:
URL: https://github.com/apache/arrow/pull/9598#discussion_r590472008



##########
File path: dev/merge_arrow_pr.py
##########
@@ -547,6 +566,86 @@ def get_pr_num():
     return input("Which pull request would you like to merge? (e.g. 34): ")
 
 
+_JIRA_COMPONENT_REGEX = re.compile(r'(\[[^\]]*\])+')
+
+# Maps PR title prefixes to JIRA components
+PR_COMPONENTS_TO_JIRA_COMPONENTS = {
+    '[Rust]': 'Rust',
+    '[Rust][DataFusion]': 'Rust - DataFusion',
+    '[C++]': 'C++',
+    '[R]': 'R',
+}
+
+
+# Return the best matching JIRA component from a PR title, if any
+# "[Rust] Fix something" --> Rust
+# "[Rust][DataFusion] Fix" --> Rust - DataFusion
+# "[CPP] Fix " --> "C++"
+def jira_component_name_from_title(title):
+    match = _JIRA_COMPONENT_REGEX.match(title.strip())
+    if match:
+        pr_component = str(match.group(0))
+        return PR_COMPONENTS_TO_JIRA_COMPONENTS.get(pr_component)
+
+
+# If no jira ID can be found for the PR, offer to create one
+# returns returns the github pr_data

Review comment:
       Duplicate word: `returns returns`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to