diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1f97c51..3fd1648 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -207,21 +207,40 @@ lane :installProfiles do end desc "Updates project dependencies in Bundler and CocoaPods, then sends a pull request if there are changes" -lane :updateDependencies do +desc "#### Options" + desc " * **`branchname`**: Accepts an optional value to set the dependency updater branch. If no value is passed in, it will default to the ENV variable name." + desc " * **`base`**: Accepts an optional value to set the base branch for the created dependency update PR. If no value is passed in, it will default to master." + desc " * **`pullRequestTitle`**: Accepts an optional value to set the title for the created dependency update PR. If no value is passed in, it will default to Update Dependencies." +lane :updateDependencies do |options| + options[:branchname] ||= ENV["UPDATE_DEPENDENCIES_BRANCH"] + options[:base] ||= "master" + options[:pullRequestTitle] ||= "Update Dependencies" + fastlane_require 'fastlane-plugin-git_status' - xcversion(version: ENV["XCODE_VERSION"] || '~> 10.2') + + xcversion(version: ENV["XCODE_VERSION"] || '~> 11.3') bundle_update if File.exist?("../Gemfile.lock") cocoapods_update if File.exist?("../Podfile.lock") carthage(command: "update", no_build: true) if File.exist?("../Cartfile.resolved") - sendUpdatePullRequest unless git_status.empty? + + sendUpdatePullRequest( + branchname: options[:branchname], + base: options[:base], + pullRequestTitle: options[:pullRequestTitle] + ) unless git_status.empty? end desc "Sends a pull request with the current changes to dependencies" -lane :sendUpdatePullRequest do - fastlane_require 'fastlane-plugin-git_status' +lane :sendUpdatePullRequest do |options| + options[:branchname] ||= ENV["UPDATE_DEPENDENCIES_BRANCH"] + options[:base] ||= "master" + options[:pullRequestTitle] ||= "Update Dependencies" - branchname = ENV["UPDATE_DEPENDENCIES_BRANCH"] + fastlane_require 'fastlane-plugin-git_status' + branchname = options[:branchname] + base = options[:base] + create_git_branch( branchname: branchname ) @@ -251,8 +270,8 @@ lane :sendUpdatePullRequest do api_token: ENV["GITHUB_TOKEN"], repo: ENV["GITHUB_REPO"], head: branchname, - base: "master", - title: "Update Dependencies" + base: base, + title: options[:pullRequestTitle] ) end