God always goes beyond our actions to see what’s in our hearts. The intent of the heart is a key to God’s judgment of our actions. Charles Finney has an excellent commentary on that in his Systematic Theology:
It is a saying as common as men are, and as true as common, that men are to be judged by their motives, that is, by their designs, intentions. It is impossible for us not to assent to this truth. If a man intend evil, though, perchance, he may do us good, we do not excuse him, but hold him guilty of the crime which he intended
So if he intend to do us good, and, perchance, do us evil, we do not, and cannot condemn him. For this intention and endeavor to do us good, we cannot blame him, although it has resulted in evil to us.
He may be to blame for other things connected with the affair. He may have come to our help too late, and have been to blame for not coming when a different result would have followed; or he may have been blamable for not being better qualified for doing us good. He may have been to blame for many things connected with the transaction, but for a sincere, and of course hearty endeavor to do us good, he is not culpable, nor can he be, however it may result.
If he honestly intended to do us good, it is impossible that he should not have used the best means in his power, at the time. This is implied in honesty of intention. And if he did this, reason cannot pronounce him guilty, for it must judge him by his intentions.
When Jesus chastised the Pharisees, He didn’t criticize their outward actions—praying, fasting, tithing, etc.—but He did point to their motives for doing all those outwardly good deeds. He’s far more interested in our hearts than our actions, although, of course, actions will have consequences. And there’s no way to hide our hearts from Him. I’m reminded of this passage from the book of Hebrews, chapter 4:
For the word of God is living and active and sharper than any two-edged sword, and piercing as far as the division of soul and spirit, of both joints and marrow, and able to judge the thoughts and intentions of the heart. And there is no creature hidden from His sight, but all things are open and laid bare to the eyes of Him with whom we have to do.
We need to look to our hearts and get our motives straight. Our actions should be the result of love for God, not personal gain for self. He sees the difference and judges accordingly.