Heroku: Display Git Revision Hash and Timestamp in Views?

前端 未结 5 1793
盖世英雄少女心
盖世英雄少女心 2021-02-15 15:22

Let\'s say I have a Rails application deployed on Heroku. How can I display these pieces of information in my views?

  • The Git hash for the last revision
  • Th
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-15 15:52

    Heroku sets an environment variable with the commit hash ENV['COMMIT_HASH'].

    As for the timestamp, you could hit the github api with the hash if you host your code there. Looks like the ruby-github gem can help you with this, or you could do it yourself with HTTParty.

提交回复
热议问题