To be able to have an affair, you have to repeatedly deceive and lie to your partner. You are also giving them the delusion that they are in a monogamous relationship - gaslighting. If you are having sex with them, you are denying them informed consent, because they do not know you are putting them at risk of STDs.
We are the sum of our actions. That means you cannot do these things and be a good person. It's like the idiot celebrities who get caught out in wrong-doing and say 'this isn't who I am'. Yes, it's exactly who you are.
I say this as someone who had an affair, and saw what it did to my then-partner. It showed me what kind of person I had become. I did not want to be that person, so I vowed never to cheat again - and I never have.
If I were a different type of person, I could have made excuses for myself, and they would have appeared to be true - to me, to others, and probably even to him, because no relationship is perfect, and we should have broken up sooner. But luckily, even when I was a selfish arsehole, I was self-aware enough to know that, and empathic enough to genuinely regret what I had done to him (I wasn't caught, I confessed). Luckily for me, because if I had chosen the other option, I'd have become a different person to the one I am today. A worse person, who would have cheated again, because I would have been a person who believed that cheating could be justified.
Cheating is on the cheater - it isn't 50/50 at all. That's just the lie of the reconciliation industry, since 'this relationship is not salvageable because you are tied to an accomplished liar' doesn't bring in anywhere near so much money.
There is always another way. And however difficult, I'd venture it's less difficult all round than having an affair. I've never seen honesty result in a worse outcome than deception in the long term.