Macbook Air 2017 won't charge
If this happened just recently as you describe, you may have an electrical issue; especially if it's happening only on certain electrical outlets.

What this sounds like is that something on your DC-in board has been shorted to ground (the whole case is grounded). The fix would be to simply replace this board.



iFixit.com has a guide on how to replace it.  It's rated as difficult because you have to remove the battery, so if this is not your cup of tea, it's best that you take it in for service.

However, before doing so, I would get the electrical system in your home/office (where ever you're having the problem) checked out because if that's the problem, you'll be doing this fix all over again.  If that's not an option, plug into a high quality surge protector or UPS (APC and CyberPower are two brands I recommend)