Hi,
You are likely not firing the ray as you imagine you do,
"Game object compare tag" works in all situations, so it's likely that the Raycast2D is not finding anything to begin with.
I doubled checked and everything is working as expected.
can you debug the ray ( check the "debug" option in the action") and make sure you see a yellow line in the scene view that is exactly what you expect the raycast to be, if you don't see that yellow line, then it's your setup that is wrong.
bye,
Jean