-
Notifications
You must be signed in to change notification settings - Fork 422
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
Add typescript support for script files. #294
Comments
This would also allow to statically check these scripts before running, e.g. help with rhysd/actionlint#55. This would have prevented plenty of mishaps that I caused… |
As a PoC I made a wrapper around github-script to use typescript sources https://github.com/Flydiverny/github-typescript it adds a small overhead as it uses esbuild binary to convert into JS. |
Also the tsx project allows for doing some workarounds, and might lead to a solution here:
In this I'm using tsx's programmatic API to load another file that's typescript. Only caveat is that it can't find tsx in order to import it... So I'm solving that problem... |
@kf6kjg thanks for you suggestion! I managed to make it work with: const { tsImport } = await import('${{ github.workspace }}/.github/node_modules/tsx/dist/esm/api/index.cjs');
const { myFn } = await tsImport('./.github/scripts/my-file.ts', '${{ github.workspace }}/'); |
Just put in #477 with what is unit testing as a functional support for TypeScript! |
Is your feature request related to a problem? Please describe.
All my source is typescript except for the ones for githup-script.
Describe the solution you'd like
Add support for loading typescript files.
Describe alternatives you've considered
Run the typescript compiler to convert the ts file to a js file before executing it with this action.
Additional context
The text was updated successfully, but these errors were encountered: