Module: WerckerBundleUpdatePr
- Defined in:
- lib/wercker_bundle_update_pr.rb,
lib/wercker_bundle_update_pr/version.rb
Overview
An automation script to ‘bundle update` and send pull request via Wercker’s Trigger Build API
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
Class Method Details
.run(username: nil, email: nil, branches: ['master']) ⇒ Object
Main process
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wercker_bundle_update_pr.rb', line 11 def self.run(username: nil, email: nil, branches: ['master']) raise '$WERCKER_GIT_OWNER not set' unless ENV['WERCKER_GIT_OWNER'] raise '$WERCKER_GIT_REPOSITORY not set' unless ENV['WERCKER_GIT_REPOSITORY'] raise '$GITHUB_ACCESS_TOKEN not set' unless ENV['GITHUB_ACCESS_TOKEN'] username ||= client.user.login email ||= "#{username}@users.noreply.github.com" return unless bundle_update?(branches) repository = "#{ENV['WERCKER_GIT_OWNER']}/#{ENV['WERCKER_GIT_REPOSITORY']}" now = Time.now branch = "bundle-update-#{now.strftime('%Y%m%d%H%M%S')}" create_branch(username, email, branch) pull_request = create_pull_request(repository, branch, now) add_compare_linker_comment(repository, pull_request[:number]) end |