lib/hatchet/git_app.rb in heroku_hatchet-7.2.0 vs lib/hatchet/git_app.rb in heroku_hatchet-7.3.0

- old
+ new

@@ -3,36 +3,38 @@ class GitApp < App def git_repo "https://git.heroku.com/#{name}.git" end - def push_without_retry! output = "" ShellThrottle.new(platform_api: @platform_api).call do output = git_push_heroku_yall rescue FailedDeploy => e - if e.output.match?(/reached the API rate limit/) + case e.output + when /reached the API rate limit/, /429 Too Many Requests/ throw(:throttle) - elsif @allow_failure - output = e.output else - raise e + raise e unless @allow_failure + output = e.output end end return output end + def releases + platform_api.release.list(name) + end + private def git_push_heroku_yall output = `git push #{git_repo} HEAD:main 2>&1` if !$?.success? raise FailedDeployError.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}", output: output) end - releases = platform_api.release.list(name) if releases.last["status"] == "failed" commit! # An empty commit allows us to deploy again raise FailedReleaseError.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}", output: output) end