How to use JavaScript in GitHub Actions without committing <code>node_modules</code>

I was creating my first GitHub Action. According to the official documentation, I should commit the node_modules to the repo or generate a script that bundles the whole node_modules if I want to create a JavaScript action. I think this is not good practice, so I try to find another way: manually managing the caches for the dependencies in node_modules .