class Ruboty::Github::Actions::CreateDeployPullRequest
Private Instance Methods
body()
click to toggle source
# File lib/ruboty/github/actions/create_deploy_pull_request.rb, line 23 def body lines = included_pull_requests.map do |pr| "- [##{pr[:number]}](#{pr[:html_url]}): #{pr[:title]} by @#{pr[:user][:login]}" end lines.unshift('## Pull Requests to deploy', '') lines.join("\n") end
comparison()
click to toggle source
# File lib/ruboty/github/actions/create_deploy_pull_request.rb, line 43 def comparison @comparison ||= begin start = client.branch(repository, to_branch)[:commit][:sha] endd = client.branch(repository, from_branch)[:commit][:sha] client.compare(repository, start, endd) end end
create()
click to toggle source
Calls superclass method
# File lib/ruboty/github/actions/create_deploy_pull_request.rb, line 9 def create super return unless database_schema_changed? message.reply(ENV.fetch('MIGRATION_WARNING_MESSAGE', '@here :warning: This deployment includes some database migrations')) end
database_schema_changed?()
click to toggle source
# File lib/ruboty/github/actions/create_deploy_pull_request.rb, line 39 def database_schema_changed? comparison.files.any? { |file| file.filename == 'db/schema.rb' } end
included_pull_requests()
click to toggle source
# File lib/ruboty/github/actions/create_deploy_pull_request.rb, line 31 def included_pull_requests numbers = comparison.commits.map do |commit| /^Merge pull request #(\d+) from/ =~ commit[:commit][:message] ::Regexp.last_match(1) end numbers.compact.map { |number| client.pull_request(repository, number.to_i) } end
to_branch()
click to toggle source
e.g. master
# File lib/ruboty/github/actions/create_deploy_pull_request.rb, line 19 def to_branch to.split(':').last end