How can an action from the actions module be executed programatically? In D7 there was actions_do() but in D8 actions are plugins or configuration entities according to https://www.drupal.org/node/2020549.
You should inject the plugin manager as a service if possible, but for a plugin (code) based action:
$manager = \Drupal::service('plugin.manager.action'); $action = $manager->createInstance('action_plugin_id') $action->execute();
Or if it's an advanced action, it's a config entity, so load and execute it that way:
$action = \Drupal\system\Entity\Action::load($action_id); $action->execute();
Again if DI is an option, inject the entity type manager service and use that to load the action instead.