How to pass dynamic parameters through a local action button?
Local actions and local tasks are quite similar, so looking at the Customising local task behavior I've managed to pass in dynamic route parameters to my local actions by specifying the class parameter (MyClassName) in my_module.links.action.yml and overriding the LocalActionDefault::getRouteParameters() method in that class. Only one initial cache rebuild was required.

use Drupal\Core\Menu\LocalActionDefault;
use Drupal\Core\Routing\RouteMatchInterface;

class MyClassName extends LocalActionDefault {

  public function getRouteParameters(RouteMatchInterface $route_match) {
    return array(
      'my_local_action_parameter' =&gt; $route_match-&gt;getParameter('existing_parameter_from_route')
    );
  }
}