An anti-phase boundary is formed by shifting a portion of photonic crystal lattice along the direction of periodicity. A spinning magnetic dipole is applied to excite edge modes on the anti-phase boundary. We show the unidirectional propagation of the edge modes which is also known as spin-momentum locking. Band inversion of the edge modes is discovered when we sweep the geometrical parameters, which leads to a change in the propagation direction. Also, an optimized source is applied to excite the unidirectional edge mode with high directivity.