This behavior pack uses scripts to detect the health of the player and convert it to a scoreboard objective.
Donwload the latest release mcpack from the Releases Page
You can display the scoreboard objective detect:health or target players using the scores as part of the target selector arguments:
/scoreboard objectives setdisplay sidebar detect:health
execute as @a run titleraw @s actionbar {"rawtext":[{"text":"Health: "}, {"score":{"name":"*", "objective":"detect:health"}}]}
execute as @a[scores={detect:health=20}] at @s run <your-command-here> _ _ _ _ _
(_) _ _ | | | | | | |
____ _ _| |_ _| |_ _____ ____ ___| |___| |_____| | |
| \| (_ _|_ _) ___ | _ \ /___)_____ (____ | | |
| | | | | | |_ | |_| ____| | | |___ | | / ___ | | |
|_|_|_|_| \__) \__)_____)_| |_(___/ |_\_____|\_)_)