Question i5-12600k causing bootloop ?

Dec 22, 2022
i built my first pc 8 months ago:
i5 12600k
rtx 3070 ti
32gb ram
650 psu

my pc was working fine and then 5 days ago when i was gaming i closed the game and after 5 minutes my pc restarted and then it got stuck in bootloop and nothing was showing on screen. At first i thought it was the psu so i tested another psu and still had the same problem so then i removed everything and kept only the cpu and still had the problem.
Then i tested another cpu same as mine i5-12600k and it worked fine. I tested my cpu in another motherboard and it started bootlooping on that as well so it was obvious the problem was the CPU.

If anyone have an idea how to fix this please tell me.
sorry for bad english not my first language