On the verge of (doing something)

Just about to do something.

I was on the verge of quitting my job when I suddenly changed my mind.