title: Get hash of the latest deployed commit in Heroku
body: <p>How to actually get hash of the latest commit deployed to Heroku in 2022?</p>
  <hr />
  <p>Yes, this is a duplicate of a lot of other SO questions. But neither of them worked for me.</p>
  <ol>
  <li><strong><a href="https://stackoverflow.com/questions/12217645/access-current-git-commit-number-from-within-heroku-app">Access current git commit number from within Heroku app</a></strong>
  <ul>
  <li><code>SOURCE_VERSION</code> property does not exist on <code>process.env</code> (not even <code>undefined</code>);</li>
  <li>logging the whole <code>process.env</code> object, I couldn't find any environment variable that would contain anything remotely relevant;</li>
  <li><code>/etc/heroku/dyno</code> file does not exist on runtime;</li>
  </ul>
  </li>
  <li><strong><a href="https://stackoverflow.com/questions/14583282/heroku-display-hash-of-current-commit-in-browser">Heroku - Display hash of current commit in browser</a></strong>
  <ul>
  <li><code>heroku config</code> doesn't show anything relevant;</li>
  <li><code>heroku labs:enable runtime-dyno-metadata</code> – Heroku Labs is <a href="https://stackoverflow.com/questions/37570681/enable-heroku-labs-feature-in-heroku-review-apps">not supported</a> for Heroku Review Apps, which I am a heavy user of;</li>
  <li><a href="https://stackoverflow.com/a/14924922/4554883"><code>post-commit</code> hook</a> seems too hacky, I'm considering this approach as a last resort;</li>
  </ul>
  </li>
  </ol>
  <p>Similar to using <code>post-commit</code> hook, I could use available values of <code>process.env.npm_package_repository_url</code>, and <code>process.env.HEROKU_PR_NUMBER</code> to fetch the latest commit hash through an HTTP call. Similarly, I'm considering this approach as a last resort.</p>