Drupal 8 获取指定entity type的action

function getActions($type) {
    $actionEntityTypeManager = \Drupal::entityTypeManager()->getStorage('action');
    $actions = array_filter($actionEntityTypeManager->loadMultiple(), function ($action) use($type) {
      return $action->getType() == $type;
    });

    $action_options = [];
    foreach($actions as $id => $action) {
      $action_options[$action->id()] = $action->label();
    }
    return $action_options;
  }