A palladium-catalyzed one-pot procedure of N–H insertion and Heck cyclization/base promoted cyclization has been developed.