The action for higher spin black holes in three dimensions