One approach is to use either an IF/THEN or Switch Action based on the macOS version. For an example, see:
For more information, see the wiki Searching the Forum for Answers section.