Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Latest commit

 

History

History
31 lines (24 loc) · 909 Bytes

heroku.md

File metadata and controls

31 lines (24 loc) · 909 Bytes

Heroku

Backfill releases on GH

app = "YOUR_HEROKU_APPNAME"
key = `heroku auth:token`.strip

require "base64"
require "net/http"
require "json"

def http_get(url, headers)
  uri = URI.parse(url)
  Net::HTTP.start(uri.host, uri.port, { use_ssl: uri.scheme == "https" }) do |http|
    return http.request_get(uri.path, headers)
  end
end

response = http_get("https://api.heroku.com/apps/#{app}/releases", {
  "Authorization" => "Basic #{Base64.encode64(':'+key).strip}",
  "Accept" => "application/vnd.heroku+json; version=3",
  "Range" => "; max=1000",
})

data = JSON.parse(response.body)
deploys = data.select { |r| r["description"].start_with?("Deploy ") }
puts deploys.map { |r| "GIT_COMMITTER_DATE='#{r["created_at"]}' git tag heroku/v#{r["version"]} " + r["description"][/[0-9a-f]{7}/] }.join("\n")

Source: github-release-party