Execute actions (actions module not rules module) programatically
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-&gt;createInstance('action_plugin_id')
$action-&gt;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-&gt;execute();


Again if DI is an option, inject the entity type manager service and use that to load the action instead.