How do I create a custom rule action?
Check the actions of the Rules module:

http://cgit.drupalcode.org/rules/tree/src/Plugin/RulesAction?h=8.x-3.x

These are the actions provided out of the box by Rules.

Each action class has a @RulesAction annotation. Wire that up and you should see your Rules action appear. Think of the annotation here very similar to what you would have in hook_rules_action_info().

The only exception is instead of defining it in the .module file, it will live in mymodule/src/Rules/Plugin/RulesAction/NameOfYourAction.php.

Here is an example of what it might look like:

namespace Drupal\mymodule\Plugin\RulesAction;

use Drupal\user\UserInterface;
use Drupal\rules\Core\RulesActionBase;

/**
 * Provides a 'custom action' action.
 *
 * @RulesAction(
 *   id = "mymodule_custom_action",
 *   label = @Translation("Custom Action"),
 *   category = @Translation("Custom"),
 *   context = {
 *     "user" = @ContextDefinition("entity:user",
 *       label = @Translation("User"),
 *       description = @Translation("Specifies the user we are taking action on.")
 *     ),
 *   }
 * )
 *
 */
class NameOfYourAction extends RulesActionBase {

  /**
   * Flag that indicates if the entity should be auto-saved later.
   *
   * @var bool
   */
  protected $saveLater = FALSE;

  /**
   * Does something to the user entity.
   *
   * @param \Drupal\user\UserInterface $account
   *   The user to take action on.
   */
  protected function doExecute(UserInterface $account) {
    // execution code
    // you may want to set $this-&gt;saveLater based on your use case
  }

  /**
   * {@inheritdoc}
   */
  public function autoSaveContext() {
    if ($this-&gt;saveLater) {
      return ['user'];
    }
    return [];
  }

}


Please note that at the time of this writing, Rules is in alpha release state. It may change with subsequent releases.