def update_issue_status()

in jbi/jira/service.py [0:0]


    def update_issue_status(self, context: ActionContext, jira_status: str):
        """Update the status of the Jira issue"""
        issue_key = context.jira.issue
        assert issue_key  # Until we have more fine-grained typing of contexts

        kwargs: dict[str, Any] = {}
        if jira_status == "Cancelled":
            kwargs["fields"] = {
                "resolution": {"name": "Invalid"},
            }
            kwargs["update"] = {
                "comment": [{"add": {"body": "Issue was cancelled."}}],
            }

        logger.info(
            "Updating Jira status to %s",
            jira_status,
            extra=context.model_dump(),
        )
        return self.client.set_issue_status(
            issue_key,
            jira_status,
            **kwargs,
        )