def get_parent_liveaction(liveaction_db):
    """Get the liveaction for the parent workflow

    Useful for finding the parent workflow. Pass in any LiveActionDB instance,
    and this function will return the liveaction of the parent workflow.

    :param liveaction_db: The LiveActionDB instance for which to find the parent.
    :rtype: LiveActionDB
    """

    parent = liveaction_db.context.get("parent")

    if not parent:
        return None

    parent_execution_db = ActionExecution.get(id=parent["execution_id"])
    parent_liveaction_db = LiveAction.get(id=parent_execution_db.liveaction["id"])

    return parent_liveaction_db
Get the liveaction for the parent workflow

    Useful for finding the parent workflow. Pass in any LiveActionDB instance,
    and this function will return the liveaction of the parent workflow.

    :param liveaction_db: The LiveActionDB instance for which to find the parent.
    :rtype: LiveActionDB
    
st2common/st2common/services/action.py