Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jira] Examples of updating a issue using operations #1331

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions examples/jira/jira_edit_issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# coding=utf-8
from atlassian import Jira

""" Examples of updating a issue using operations """

jira = Jira(url="https://jira.example.com/", username="admin", password="password")

""" Adding a labels """

labels = ["example", "atlassian"]

fields = {"labels": [{"add": label} for label in labels]}

jira.edit_issue(issue_id_or_key="ABC-123", fields=fields)

""" Adding a labels and removing another """

add_labels = ["team", "jira"]
remove_labels = ["example", "atlassian"]

fields = {"labels": [{"add": label} for label in add_labels] + [{"remove": label} for label in remove_labels]}

jira.edit_issue(issue_id_or_key="ABC-123", fields=fields)

""" Setting the assignee """

fields = {"assignee": [{"set": {"name": "bob"}}]}

jira.edit_issue(issue_id_or_key="ABC-123", fields=fields)


""" Setting the assignee without notification """

fields = {"assignee": [{"set": {"name": "alice"}}]}

jira.edit_issue(issue_id_or_key="ABC-123", fields=fields, notify_users=False)

""" Manipulating multiple fields """

fields = {"assignee": [{"set": {"name": "bob"}}], "summary": [{"set": "new summary"}], "labels": [{"add": "blog"}]}

jira.edit_issue(issue_id_or_key="ABC-123", fields=fields)
Loading