Heroku: Display Git Revision Hash and Timestamp in Views?

前端 未结 5 1798
盖世英雄少女心
盖世英雄少女心 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:44

    There is grit installed on Heroku. So you can open the repository there using it.

    repo = Repo.new(Rails.root + '.git')
    last_commit = repo.commits.first
    p last_commit.id
    p last_commit.authored_date
    

提交回复
热议问题