Skip to content

Commit e8c2f54

Browse files
committed
supervisor/jira_utils.py: add remove_issue_label()
Add a function to remove a label from a JIRA issue.
1 parent 805e106 commit e8c2f54

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

supervisor/jira_utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,24 @@ def add_issue_label(
572572
jira_api_put(path, json=body)
573573

574574

575+
def remove_issue_label(
576+
issue_key: str, label: str, comment: CommentSpec = None, *, dry_run: bool = False
577+
) -> None:
578+
path = f"issue/{urlquote(issue_key)}"
579+
body: dict[str, Any] = {
580+
"update": {"labels": [{"remove": label}]},
581+
}
582+
if comment is not None:
583+
_add_comment_update(body["update"], comment)
584+
585+
if dry_run:
586+
logger.info("Dry run: would remove label %s from issue %s", label, issue_key)
587+
logger.debug("Dry run: would post %s to %s", body, path)
588+
return
589+
590+
jira_api_put(path, json=body)
591+
592+
575593
def add_issue_attachments(
576594
issue_key: str,
577595
attachments: list[tuple[str, bytes, str]],

0 commit comments

Comments
 (0)