Class: Fastlane::Actions::CreateBitbucketPullRequestAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::CreateBitbucketPullRequestAction
- Defined in:
- lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(_platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 37 def self. ['Issarapong Poesua'] end |
.available_options ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 50 def self. [ FastlaneCore::ConfigItem.new(key: :head, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_HEAD', description: 'The name of the branch where your changes are implemented', type: String), FastlaneCore::ConfigItem.new(key: :target, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_TARGET', description: 'The name of the branch you want your changes pulled into', type: String), FastlaneCore::ConfigItem.new(key: :owner, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_REPOSITORY_OWNER', description: 'The name of the repository owner (slug)', type: String), FastlaneCore::ConfigItem.new(key: :repository, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_REPOSITORY_NAME', description: 'The name of the repository you want to submit the pull request to', type: String), FastlaneCore::ConfigItem.new(key: :title, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_TITLE', description: 'The title of the pull request', type: String), FastlaneCore::ConfigItem.new(key: :description, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_DESCRIPTION', description: 'The contents of the pull request', type: String), FastlaneCore::ConfigItem.new(key: :username, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_USERNAME', description: 'The Bitbucket username (email)', type: String), FastlaneCore::ConfigItem.new(key: :password, env_name: 'CREATE_BITBUCKET_PULL_REQUEST_PASSWORD', description: 'The Bitbucket password', type: String) ] end |
.description ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 33 def self.description 'This lane creates create bitbucket pull request' end |
.details ⇒ Object
45 46 47 48 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 45 def self.details # Optional: 'This lane creates create bitbucket pull request' end |
.is_supported?(_platform) ⇒ Boolean
87 88 89 90 91 92 93 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 87 def self.is_supported?(_platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end |
.return_value ⇒ Object
41 42 43 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 41 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fastlane/plugin/create_bitbucket_pull_request/actions/create_bitbucket_pull_request_action.rb', line 10 def self.run(params) UI.("Creating new bitbucket pull request from '#{params[:head]}' to branch '#{params[:target]}' of '#{params[:owner]}/#{params[:repository]}'") response = JSON.parse(Net::HTTP.post( URI("https://api.bitbucket.org/2.0/repositories/#{params[:owner]}/#{params[:repository]}/pullrequests"), { "destination": { "branch": { "name": params[:target] } }, "source": { "branch": { "name": params[:head] } }, "title": params[:title], "description": params[:description] }.to_json, "Authorization": "Basic #{Base64.encode64("#{params[:username]}:#{params[:password]}").gsub("\n", '')}", "Content-Type": 'application/json' ).body) if response['error'] raise(response['error']['message']) else UI.('The pull request has been created successfully') UI.((response['links']['html']['href']).to_s) response['links']['html']['href'] end end |