This question already has an answer here:

A enemy wizard cast lightning bolt while within five feet of a tempest domain cleric. The cleric inquired if the lightning bolt triggers the wrath of the storm feature since the enemy wizard was "attacking him."

Wrath of the Storm description says:

When a creature within 5 feet of you that you can see hits you with an attack, you can use your reaction to cause the creature to make a Dexterity saving throw. The creature takes 2d8 lightning or thunder damage


marked as duplicate by Sdjz, Premier Bromanov, NautArch dnd-5e Mar 4 at 16:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.