How to actually get hash of the latest commit deployed to Heroku in 2022?
Yes, this is a duplicate of a lot of other SO questions. But neither of them worked for me.
- Access current git commit number from within Heroku app
SOURCE_VERSIONproperty does not exist onprocess.env(not evenundefined);- logging the whole
process.envobject, I couldn't find any environment variable that would contain anything remotely relevant; /etc/heroku/dynofile does not exist on runtime;
- Heroku - Display hash of current commit in browser
heroku configdoesn't show anything relevant;heroku labs:enable runtime-dyno-metadata– Heroku Labs is not supported for Heroku Review Apps, which I am a heavy user of;post-commithook seems too hacky, I'm considering this approach as a last resort;
Similar to using post-commit hook, I could use available values of process.env.npm_package_repository_url, and process.env.HEROKU_PR_NUMBER to fetch the latest commit hash through an HTTP call. Similarly, I'm considering this approach as a last resort.