Minecraft wiki entry for Target_selectors, associated text: Examples in Java Edition:
@e[y_rotation=0] — Select all entities that are facing due south.
@e[y_rotation=-90..0] — Select all entities that are facing in the 90° between due east and due south (inclusive).
@e[y_rotation=0..180] — Select all entities that are not facing at all east.