Skip to content

Commit 9d2befe

Browse files
committed
Add "Create Done Status" in docs #350
Signed-off-by: tdruez <[email protected]>
1 parent 8346231 commit 9d2befe

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

docs/integrations-jira.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Prerequisites
1414
- A **Jira user account** with sufficient permissions
1515
(at least *Create Issues* and *Edit Issues*) in that project.
1616

17-
Create Custom *DejaCode Request* Work Type
17+
Create Custom "DejaCode Request" Work Type
1818
------------------------------------------
1919

2020
.. warning::
@@ -28,6 +28,27 @@ To create the custom work type in Jira:
2828
3. Set the name to: ``DejaCode Request``
2929
4. Click **Create**
3030

31+
Create "Done" Status
32+
--------------------
33+
34+
.. warning::
35+
36+
This is required for the integration to function properly.
37+
38+
This status will be set on the Jira issue when the DejaCode Request is closed.
39+
40+
To create the **Done** status in Jira:
41+
42+
1. Navigate to **Project settings** → **Work types**
43+
2. Select the ``DejaCode Request`` work type
44+
3. Click **Edit workflow**
45+
4. Click **Add status**
46+
5. Click **Create new status** tab
47+
6. Enter the name: ``Done``
48+
7. Choose a category: ``Done``
49+
8. Click **Add**
50+
9. Click **Update workflow**
51+
3152
Jira API Token
3253
--------------
3354

workflow/integrations/jira.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class JiraIntegration(BaseIntegration):
2121
from DejaCode requests.
2222
"""
2323

24-
default_issuetype = "DejaCode Request"
24+
issuetype = "DejaCode Request"
25+
closed_status = "Done"
2526

2627
def get_headers(self):
2728
jira_user = self.dataspace.get_configuration("jira_user")
@@ -54,7 +55,7 @@ def sync(self, request):
5455
issue_id=external_issue.issue_id,
5556
title=self.make_issue_title(request),
5657
body=self.make_issue_body(request),
57-
status="Done" if request.is_closed else None,
58+
status=self.closed_status if request.is_closed else None,
5859
)
5960
else:
6061
issue = self.create_issue(
@@ -76,7 +77,7 @@ def create_issue(self, project_key, title, body=""):
7677
"project": {"key": project_key},
7778
"summary": title,
7879
"description": markdown_to_adf(body),
79-
"issuetype": {"name": self.default_issuetype},
80+
"issuetype": {"name": self.issuetype},
8081
}
8182
}
8283
return self.post(url, json=data)
@@ -112,6 +113,7 @@ def transition_issue(self, issue_id, target_status_name):
112113
response_json = self.get(url=transitions_url)
113114
transitions = response_json.get("transitions", [])
114115

116+
# Search for a transition name that match the `target_status_name`
115117
for transition in transitions:
116118
if transition["to"]["name"].lower() == target_status_name.lower():
117119
transition_id = transition["id"]

0 commit comments

Comments
 (0)