You can use this script to delete former workers from Flex.
This script will be executed nightly via Github Actions. More details here.
- clone this repo;
npm install
- rename
.env-example
to.env
and put your secrets there. - create some dummy workers to be deleted with
npm run create
- now delete these workers doing
npm run delete
- you will notice no workers were deleted, this is because:
- you just created the workers and this script is only deleting workers older than 30 days. Open
delete-workers.ts
and changeDELETE_OLDER_THAN_X_DAYS
to0
. - once you are fine with this script and are confident to put it in production, you can remove the block
if (!friendlyName.includes('test'))
... I added this safety to make sure you won't delete real workers by mistake while working with this script.
- you just created the workers and this script is only deleting workers older than 30 days. Open
- Fork this repo
- Follow the same steps as running it locally, above. Just ignore the step 3 (the
.env
part) and instead, create the secrets needed for this script to run:
3. Go to "Actions" tab in your github repo and enable it to run nightly.