Skip to content

Commit

Permalink
Use simpler "JIRA:" label to match Jira ID in GitHub PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk authored and ralphbean committed Feb 6, 2025
1 parent a298282 commit e5fa228
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/config-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sync2jira/intermediary.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ 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:
"""
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
Expand Down

0 comments on commit e5fa228

Please sign in to comment.