def repo_modified_handler(payload: Dict[str, Any]) -> List[Dict[str, str]]: subject_new = BITBUCKET_TOPIC_TEMPLATE.format( repository_name=payload["new"]["name"]) body = BITBUCKET_REPO_UPDATED_CHANGED.format( actor=payload["actor"]["name"], change="name", repo_name=payload["old"]["name"], old=payload["old"]["name"], new=payload["new"]["name"] ) # As of writing this, the only change we'd be notified about is a name change. return [{"subject": subject_new, "body": body}]
def repo_modified_handler(payload: Dict[str, Any]) -> List[Dict[str, str]]: subject_new = BITBUCKET_TOPIC_TEMPLATE.format(repository_name=payload["new"]["name"]) new_name = payload["new"]["name"] body = BITBUCKET_REPO_UPDATED_CHANGED.format( actor=get_user_name(payload), change="name", repo_name=payload["old"]["name"], old=payload["old"]["name"], new=new_name, ) # As of writing this, the only change we'd be notified about is a name change. punctuation = "." if new_name[-1] not in string.punctuation else "" body = f"{body}{punctuation}" return [{"subject": subject_new, "body": body}]