How to factor `paths:` in common for push: and pull_request:?

I’d like to factor the common paths in this:

on:
  push:
    # Run only on changes on these files
    paths:
      - 'lib/**.nim'
      - 'doc/**.rst'
      - 'doc/nimdoc.css'
      - '.github/workflows/ci_docs.yml'

  pull_request:
    # Run only on changes on these files
    paths:
      - 'lib/**.nim'
      - 'doc/**.rst'
      - '.github/workflows/ci_docs.yml'

documentation mentions [push, pull_request] but it doesn’t work if we have paths node. What is the syntax to avoid code duplicat?

on: [push, pull_request] syntax is used when there are no additional configurations for push or pull_request event.
With paths filter, you need to add paths node to both push and pull_request events like what you specified in the original post. There is no way to specify the common paths for two events.
There is an example using multiple events with activity types or configuration .
I am afraid that the code duplication is a must if some paths are the same .

thanks ; I had also asked here in the meantime https://stackoverflow.com/questions/62113095/how-to-factor-paths-in-common-for-push-and-pull-request-in-github-actions/62124786#62124786

looks like the only way is to auto-generate the yml file.