See https://github.com/palantir/gradle-git-version and https://github.com/qoomon/gradle-git-versioning-plugin.
This can both help eliminate some version misalignment issues for developers and make it easier for Copilot.
A downside of this is that a developer may need to more frequently edit the commit version when iterating and debugging. Note that the GitHub Actions workflows might also need to be updated if the Git info is not available with ordinary actions/checkout.