diff --git a/docs/source/config-file.rst b/docs/source/config-file.rst index 87440c9a..1427cddc 100644 --- a/docs/source/config-file.rst +++ b/docs/source/config-file.rst @@ -112,7 +112,7 @@ The config file is made up of multiple parts .. note:: - :pullrequest: After enabling PR syncing, just type "Relates to JIRA: XXXX-1234" in the comment or description of the PR to sync with a JIRA issue. After this, updates such as when it has been merged will automatically be added to the JIRA ticket. + :pullrequest: After enabling PR syncing, just type "JIRA: XXXX-1234" in the comment or description of the PR to sync with a JIRA issue. After this, updates such as when it has been merged will automatically be added to the JIRA ticket. * You can add your projects here. The :code:`'project'` field is associated with downstream JIRA projects, and :code:`'component'` with downstream diff --git a/sync2jira/intermediary.py b/sync2jira/intermediary.py index 608a5710..c19dfd05 100644 --- a/sync2jira/intermediary.py +++ b/sync2jira/intermediary.py @@ -278,7 +278,7 @@ def map_fixVersion(mapping, issue): issue["milestone"] = fixVersion_map.replace("XXX", issue["milestone"]) -JIRA_REFERENCE = re.compile(r"Relates +to +JIRA:\s*(\w+-\d+)") +JIRA_REFERENCE = re.compile(r"\bJIRA:\s*([A-Z]+-\d+)\b") def matcher(content: Optional[str], comments: list[dict[str, str]]) -> str: @@ -286,7 +286,7 @@ def matcher(content: Optional[str], comments: list[dict[str, str]]) -> str: Helper function to match to a JIRA Extract the Jira ticket reference from the first instance of the magic - cookie (e.g., "Relates to JIRA: FACTORY-1234") found when searching + cookie (e.g., "JIRA: FACTORY-1234") found when searching through the comments in reverse order. If no reference is found in the comments, then look in the PR description. This ordering allows later comments to override earlier ones as well as any reference in the