4tals / LinksForIsrael

פורטל יוזמות - חרבות ברזל
https://linksforisrael.com
22 stars 25 forks source link

Organize scripts (remove Python, use NodeJS 20+ directly instead of github-script, move to TypeScript) #411

Open ohadschn opened 10 months ago

ohadschn commented 10 months ago

UPDATE It looks like the newest https://github.com/actions/github-script uses NodeJS 20, so dropping it might be less critical, though probably still preferable - mostly because it doesn't really offer much, see our availability monitoring script where we do just fine without it...

OpenAI for python just reached GA (1.0.x) this week: (https://pypi.org/project/openai/1.1.1/#history) Breaking changes / migration guide: https://github.com/openai/openai-python/discussions/631

However, I suggest that rather than invest the time in upgrading, we take this opportunity to encapsulate the python logic into the NodeJS (auto-pr) script. There isn't really a need for 2 separate scripts, and most of our devs know JS better than python. Also less CI work (only need to install node runtime/dependencies, etc). It also looks like the NPM package is more mature (its 1.X.Y version has been release 2 years ago: https://www.npmjs.com/package/openai?activeTab=versions).

While we're at it, I think we can also move off github-script to regular NodeJS. The former is limited to Node16 (missing some useful features) and has an annoying package adding experience (custom require method). Its main advantage can be easily obtained by using https://octokit.github.io/rest.js/v20 directly. The rest of the context is provided in environment variables anyway by the GH actions runtime.

Finally, it it's always better to use TypeScript than JavaScript.

4tal commented 10 months ago

+1 for NodeJs

ohadschn commented 9 months ago

@4tal following our WhatsApp discussion, the "move to typescript" part applies to the link availability monitor script as well.