"Open for me the gates of righteousness. In the World to Come, a person is asked 'what was your occupation?' and he replies 'I fed the hungry'. They say to him 'this is the gate of those who fed the hungry, enter into it'. Another person says 'I gave drink to the thirsty' and they say to him 'this is the gate of those who gave drink to the thirsty, enter into it'. Similarly, for clothing the naked, raising orphans, and performing acts of kindness, and for all the commandments. David said 'I have done all of these', therefore it is said 'Open for me the gates of righteousness, I will enter into them'."
Who Passes Through the Gates of Righteousness
Midrash Tehillim 118:16