How to assign a content type to a workflow programmatically?
I found a way, I would like to know your opinion about how to do it.

No doubt you have to take into account additional validations, but basically to save a type of content to a workflow would be something like this:

/** @var \Drupal\workflows\WorkflowInterface $workflow */
$workflow = $this-&gt;entityTypeManager-&gt;getStorage("workflow")-&gt;loadByProperties(["id" =&gt; "editorial"])["editorial"];
$config = $workflow-&gt;getTypePlugin()-&gt;getConfiguration();
$config["entity_types"]["node"][] = "article";
$workflow-&gt;getTypePlugin()-&gt;setConfiguration($config);
$workflow-&gt;save();


At the moment I'm just setting contents types, for blocks it's something similar.
Greetings.