aikido published a list of the affected vulns.
You can probably get a list of the repos with a github API or something.
Git clone with org admin user credentials (can be read only) so you have access to all the repos.
run grep on all package.json files, search for all of the affected repos.
No need to do any code regarding versions, just filter it down and manually process versions if needed. If you have any of these packages, no matter the versions, you should already be making efforts to migrating, kill the baby with the bathwater, cut off the arm before the gangrene spreads. At any rate you can check versions manually after you have filtered it down to something reasonable, part of automating is knowing when to stop.