# What is the action for a photon? [duplicate]

If I understand correctly, the action for a massive free particle is: $$S = -mc^2 \int \mathrm{d}\tau = -mc \int \sqrt{g_{\mu\nu} \frac{\mathrm{d}x^\mu}{\mathrm{d}\lambda} \frac{\mathrm{d}x^\nu}{\mathrm{d}\lambda}} \, \mathrm{d}\lambda$$

and from this we can derive the geodesic equation. This action functional doesn't make sense for photons though, which have $m = 0$. So what is the action for photons?

I thought about replacing $mc$ with the quantity $\hbar k$ (which has the same units) but I'm not sure whether that makes sense, given that $k$ is not constant for a photon propagating through curved space-time. (On the other hand, it makes sense that there should be a single free parameter since the propagation of light in GR is independent of the photon's momentum. But if this is the correct action then how do we actually interpret the parameter $k$?)