Migrate job from GitHub Actions to Worker
GitHub is going to start charging users for runtime in a few months. Since I'm already using workers for most of my stuff, I figured it'd be a good time to see if I can migrate to using it instead. Essentially what this job does is just run a js file (
In my particular case, this file:
1. Loads another js file used by Worker (data to register).
2. Gets secrets from env.
3. Makes an API call with said data/secret.
4. Does this again with a second secret/endpoint (same data).
Since I'd be combining the two, it'd make sense to add another step that if this fails, the deploy halts and stays on the last good version (not sure if this is standard already or not).
What would be the best way to set this up on Workers? I'm obviously expecting to need to change some variable references and such, but want to make sure I'm doing this correct and clean. I'd like to keep it within the same worker and using its own separate file (
node /src/api/register.js) whenever a specific file is updated (no need to run every time, only if there's any actual changes to registered information).In my particular case, this file:
1. Loads another js file used by Worker (data to register).
2. Gets secrets from env.
3. Makes an API call with said data/secret.
4. Does this again with a second secret/endpoint (same data).
Since I'd be combining the two, it'd make sense to add another step that if this fails, the deploy halts and stays on the last good version (not sure if this is standard already or not).
What would be the best way to set this up on Workers? I'm obviously expecting to need to change some variable references and such, but want to make sure I'm doing this correct and clean. I'd like to keep it within the same worker and using its own separate file (
/src/api/register.js), rather than depend on the main /src/api/server.js that serves everything else.