For me the secret is like the famous Article says: "Attention is all you need". I distract my attention on how much "boring", or "painful" or "humiliating" some work that I believe is important is.
I just do the work until the work is finished, but I should not feel bored, pain or humiliated while doing it.
If you feel it,It depends on the difficulty of your job, if the difficulty is not that much you can deal with it without problems but if it is hard you will eventually collapse, break down and burn out.
I use instrumental music for that and also habits. I also reward myself for the good work done.