I need to put it out there PLEASE no judging

I've been in an amazing relationship for 2 years. This is 1000% in the past, and I haven't even thought about it in so long. But about 3 years ago, I was younger and I was stupid. I was best friends with this guy and in a terrible place in my life, just awful. He was my best friend and I trusted him with all I had. The only thing was, I was in love with him and he had a girlfriend. He was a very flirtatious person. And so when he would flirt with me, he had assured me his girlfriend was aware of it all and that she didn't really care because she knew that was just his nature so I went along with it(yes I know now how naive that was especially with how far he wanted to go with it) I never really flirted back when I was in a relationship myself, but when I was single, I was told she didn't care so I didn't stop him or anything. Eventually he admitted she never actually knew of any of it and I felt awful and cut it off immediately right there. That was 3 years ago. I have no idea why its coming up in my head again now but I feel super guilty. I just can't believe I did that and I don't know how to deal with it now...