def _get_entry_point_for_worktree_path(self, pack_name, entry_point, worktree_path):
        """
        Method which returns path to an action entry point which is located inside the git
        worktree directory.

        :rtype: ``str``
        """
        pack_base_path = get_pack_base_path(pack_name=pack_name)

        new_entry_point = entry_point.replace(pack_base_path, "")

        # Remove leading slash (if any)
        if new_entry_point.startswith("/"):
            new_entry_point = new_entry_point[1:]

        new_entry_point = os.path.join(worktree_path, new_entry_point)

        # Check to prevent directory traversal
        common_prefix = os.path.commonprefix([worktree_path, new_entry_point])
        if common_prefix != worktree_path:
            raise ValueError("entry_point is not located inside the pack directory")

        return new_entry_point

        Method which returns path to an action entry point which is located inside the git
        worktree directory.

        :rtype: ``str``
        
st2common/st2common/runners/base.py