Allow comments only for the author of the node I'm using Drupal 8 for a personal project and I'd like to allow only the node author to post comments.

Can you please help? I'm stuck.
although the Drupal 8 version still is on dev but you can try comment_perm module.

The Comment Permissions module enables control of commenting by user
role and by node type. Additional user permissions for selected node
types are added to the user access system so you can configure
commenting with more control than Drupal core provides.

Update
another solution that I could suggest is using hook_form_alter.
in your custom module
function YOURMODULENAME_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {

  if($form_id == &quot;YOUR_COMMENT_TYPE_ID&quot;){
    $node = \Drupal::request()-&gt;attributes-&gt;get('node');
    if(!is_null($node) &amp;&amp; $node-&gt;getOwnerId() != \Drupal::currentUser()-&gt;id()) {
      $form['#access'] = false;
    }
  }

}