After creating an automation that gets latest released version number, merges all minor jira releases into a major and releasing the major version, i left with the minor versions unreleased and with no tickets in.

So am looking for a way to auto delete these minor versions. Reading in the community, i noticed the best workaround is with REST API via webhook - get all versions and then run over the results, extract the version i need by name and get their id for another rest api delete step. Anyone has better approch?
Thank you.