Drupal 8 - How to add task and contextual links for specific node type?
<p>I created a task link and a contextual one for base_route: entity.node.canonical</p>

<p>mymodule.routing.yml</p>

<pre><code>mymodule.mycustomroute:
  path: '/node/{node}/custom-path'
  defaults:
    _form: '\Drupal\mymodule\Form\MyForm'
  requirements:
    _permission: 'my permission'
    node: '[0-9]+'
</code></pre>

<p>mymodule.links.tasks.yml</p>

<pre><code>mymodule.mycustomroute:
  route_name: mymodule.mycustomroute
  base_route: entity.node.canonical
  title: 'my title'
</code></pre>

<p>mymodule.links.contextual.yml</p>

<pre><code>mymodule.mycustomroute:
  route_name: mymodule.mycustomroute
  group: node
</code></pre>

<p>My link shows up next to View / Edit / Delete links on each node as I wanted.</p>

<p>Now I am wondering how is it possible to make these links available only for specific node type(s)?</p>