And here’s Automator workflows that use AppleScript to rate the currently playing song. Because ratings are more-or-less deprecated, it also automatically “likes” ratings 4 and 5, and “dislikes” ratings 1 and 2.
https://github.com/JackWellborn/AppleScripts/tree/main/Music/Rate%20Track