Skip to content

Commit

Permalink
deprecate HEROKU_SLUG_COMMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Aug 23, 2024
1 parent ce1bc49 commit 7e83684
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/global_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GlobalConfig < ApplicationRecord
self.create!(key: key, value: value) unless x
end

LONG_REVISION = ENV["BUILT_AT"] || ENV["HEROKU_SLUG_COMMIT"] || "NONE"
LONG_REVISION = ENV["BUILT_AT"] || ENV["HEROKU_BUILD_COMMIT"] || "NONE"
# Bootstrap these values, and ALWAYS clobber pre-existing ones:
{
"NODE_ENV" => Rails.env || "development",
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def update_tracked_fields!(request)
def self.refresh_everyones_ui
msg = {
"type" => "reload",
"commit" => (ENV["HEROKU_SLUG_COMMIT"] || "NONE").first(8),
"commit" => (ENV["HEROKU_BUILD_COMMIT"] || "NONE").first(8),
}

Transport
Expand Down
5 changes: 3 additions & 2 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ MAX_POOL_SIZE=2

# This is set by Heroku and used by the frontend to show the current version.
# Most self hosting users will want to delete this.
HEROKU_SLUG_COMMIT=
HEROKU_BUILD_COMMIT=
HEROKU_BUILD_DESCRIPTION=

# Override for HEROKU_SLUG_COMMIT
# Override for HEROKU_BUILD_COMMIT
BUILT_AT=

# If you are a software developer and you wish to run integration tests, set the
Expand Down
13 changes: 9 additions & 4 deletions lib/tasks/hook.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
COMPARE_URL_API = "https://api.github.com/repos/Farmbot/Farmbot-Web-App/compare/"
COMPARE_URL_WEB = "https://github.com/Farmbot/Farmbot-Web-App/compare/"
COMMIT_SHA = ENV["HEROKU_SLUG_COMMIT"]
COMMIT_SHA = ENV["HEROKU_BUILD_COMMIT"]
DESCRIPTION = ENV["HEROKU_BUILD_DESCRIPTION"]
WEBHOOK_URL = ENV["RELEASE_WEBHOOK_URL"]

def open_json(url)
Expand All @@ -13,14 +14,18 @@ def open_json(url)
end

def commit_messages
base_head = "#{COMMIT_SHA}...staging"
base_head = "main...#{COMMIT_SHA}"
url = "#{COMPARE_URL_API}#{base_head}"
data = open_json(url)
commits = data.fetch("commits", [])
web_url = "#{COMPARE_URL_WEB}#{base_head}"
output = "\n\n<#{web_url}|compare>\n"
output = "\n\n"
if !DESCRIPTION.nil?
output += "#{DESCRIPTION}\n\n"
end
output += "<#{web_url}|compare>\n"
messages = commits.map do |x|
output += "\n + #{x["commit"]["message"]}"
output += "\n + #{x["commit"]["message"].gsub("\n", " ")}"
end
output
end
Expand Down

0 comments on commit 7e83684

Please sign in to comment.