Skip to content

Commit

Permalink
feat: add a from GitHub Jira label to Jira issues. #279
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Batchelder committed Nov 20, 2023
1 parent f38cd66 commit 7ab0926
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changelog.d/20231120_114120_nedbat_from_github_label_279.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. A new scriv changelog fragment.
- Now issues created in Jira will have a label of "from GitHub" on them. Closes
`issue 279`_.

.. _issue 279: https://github.com/openedx/openedx-webhooks/issues/279
2 changes: 2 additions & 0 deletions docs/details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,5 @@ bot will create a Jira issue in the Jira server with the "xyz" nickname.

Each Jira server can specify a mapping of repos to other Jira details such as
the Jira project for the issue, and the issue type to create.

Jira issues created this way will have a "from GitHub" Jira label applied.
4 changes: 1 addition & 3 deletions openedx_webhooks/tasks/pr_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ class PrDesiredInfo:
# don't need to force a new status, but can leave the existing status.
jira_status: Optional[str] = None

jira_labels: Set[str] = field(default_factory=set)

# The bot-controlled labels we want to on the pull request.
# See labels.py:CATEGORY_LABELS
github_labels: Set[str] = field(default_factory=set)
Expand Down Expand Up @@ -411,7 +409,7 @@ def _make_jira_issue(self, jira_nick) -> None:
issuetype=issuetype,
summary=self.desired.jira_title,
description=self.desired.jira_description,
labels=list(self.desired.jira_labels),
labels=["from GitHub"],
)

jira_id = JiraId(jira_nick, issue_data["key"])
Expand Down
1 change: 1 addition & 0 deletions tests/test_pull_request_opened.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ def test_jira_labelling(fake_github, fake_jira, fake_jira2):
Line2
"""
)
assert jira_issue.labels == {"from GitHub"}

# Processing the pull request again won't make another issue.
result = pull_request_changed(pr.as_json())
Expand Down

0 comments on commit 7ab0926

Please sign in to comment.