Skip to content

Commit

Permalink
Add build diff settings
Browse files Browse the repository at this point in the history
  • Loading branch information
noahsmartin committed Dec 16, 2020
1 parent 27cfe81 commit 93d2768
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.gem
Gemfile.lock
.DS_Store

## Documentation cache and generated files:
/.yardoc/
Expand Down
37 changes: 36 additions & 1 deletion lib/fastlane/plugin/emerge/actions/emerge_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,33 @@ class EmergeAction < Action
def self.run(params)
api_token = params[:api_token]
file_path = params[:file_path]
pr_number = params[:pr_number]
build_id = params[:build_id]
base_build_id = params[:base_build_id]
repo_name = params[:repo_name]
if !File.exist?(file_path) || !File.extname(file_path) == '.zip'
UI.error("Invalid input file")
return
end

fileName = File.basename(file_path)
url = 'https://2b32vitohk.execute-api.us-west-1.amazonaws.com/getUpload'
resp = Faraday.get(url, {fileName: fileName}, {'X-API-Token' => api_token})
params = {
fileName: fileName,
}
if pr_number
params[:prNumber] = pr_number
end
if build_id
params[:buildId] = build_id
end
if base_build_id
params[:baseBuildId] = base_build_id
end
if repo_name
params[:repoName] = repo_name
end
resp = Faraday.get(url, params, {'X-API-Token' => api_token})
case resp.status
when 200
json = JSON.parse(resp.body)
Expand Down Expand Up @@ -56,6 +75,22 @@ def self.available_options
env_name: "EMERGE_FILE_PATH",
description: "Path to the zipped xcarchive or app to upload",
optional: false,
type: String),
FastlaneCore::ConfigItem.new(key: :pr_number,
description: "The PR number that triggered this upload",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :build_id,
description: "A string to identify this build",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :base_build_id,
description: "Id of the build to compare with this upload",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :repo_name,
description: "Full name of the respository this upload was triggered from. For example: EmergeTools/Emerge",
optional: true,
type: String)
]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/emerge/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module Emerge
VERSION = "0.1.0"
VERSION = "0.1.1"
end
end

0 comments on commit 93d2768

Please sign in to comment.