The answer is: A
Explanation
The correct option is A: To do the right thing.
The idiom "to hit the nail right on the head" means to identify the exact point or to do something perfectly. When someone hits the nail right on the head, they accurately address or solve a problem, make a correct statement, or take an action that is precisely right for the situation. It conveys the idea of getting something exactly right.
The other options do not fit the meaning of this idiom:
B: To destroy one's reputation is unrelated to the idiom.
C: To announce one's fixed views does not convey the idea of accuracy or correctness.
D: To teach someone a lesson implies giving someone a necessary experience or punishment, which is different from hitting the nail right on the head.