Hadithcore
Mishkat al-Masabih, 83
graded· Zubair `Aliza'i

Sahl b. Sa’d reported God’s messenger as saying, “One man does the deeds of those who go to hell but is one of those who go to paradise, and another does the deeds of those who go to paradise but is one of those who go to hell, for judgment is given according to one’s final actions.” (Bukhari and Muslim).

وَعَن سهل بن سَعِيدٍ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِنَّ الْعَبْدَ لَيَعْمَلُ عَمَلَ أَهْلِ النَّارِ وَإِنَّهُ مِنْ أَهْلِ الْجَنَّةِ وَيَعْمَلُ عَمَلَ أَهْلِ الْجنَّة وَإنَّهُ من أهل النَّار وَإِنَّمَا الْعمَّال بالخواتيم»

References1 variant
In-Book Reference
Book 1, Hadith 77