"For many years you were patient with them. By your Spirit you warned them through your prophets. Yet they paid no attention, so you gave them into the hands of the neighboring peoples." - Nehemiah 9:30
The Holy Spirit is an extension of Jesus Christ, and as such, is loving but also just. The Spirit cannot abide where there is sin, just as Jesus asked those he healed to leave sin out of their lives. Therefore, as temptations come, the Holy Spirit will always raise up an "amber light", a yellow caution signal. Sometimes this comes through other Godly people, such as the prophets, sometimes it is that still and small voice inside of us gently alerting us, but the most accessible warnings are in the bible and our previous experience. "All have sinned and fallen short of the glory of God" (Romans 3:23), but that doesn't mean we should ever stop trying to learn from our mistakes, move on in humility and grace, and try to listen better to our amber light when the next time comes around.