-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript actions without checking in node_modules #100
Comments
Yeah, our recommendation here is still a little bit in flux (see actions/typescript-action#4) - when that's settled we'll probably have some better examples. The reason this failed for you is because we have a dynamic require, I added #101 to get rid of that. Once that's gone, the basic config should work. |
Ah yeah, thanks! Thanks for sending a PR that quickly! |
You can use my action here as reference: In my opinion best practice is:
|
That is certainly better than checking in |
One more advantage of using webpack is the size of the code base, which improves performance for anyone using your action. When I replaced node_modules with webpack, source code zip size reduced from ~900K to ~150K |
From the example actions like labeler, I get the impression that the idea is to check
node_modules
into VCS so that the runner can resolve the dependencies of the action at runtime.Instead of doing that, I'd much rather use a tool like webpack to bundle everything up that is necessary and only check in the generated file.
However, it seems that "@actions/github" is not compatible with that approach. My action fails at runtime because it cannot import the
event.json
file: https://github.com/thomaseizinger/actions-playground/runs/207679280For now, I resorted to not use the "@actions/" dependencies and code the requests myself since they are fairly trivial.
IMO, it would be good to have examples that use webpack and a zero-dependency JavaScript file for actions.
The project I am currently working on is here: https://github.com/thomaseizinger/assign-pr-creator-action
The text was updated successfully, but these errors were encountered: