Edge dynamics from the path integral — Maxwell and Yang-Mills