fastlane-plugin-emerge 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aff516861f028150b41676dec2e066c71cbacba42ee5703b7f580f2b9882450
4
- data.tar.gz: e16dd75722493adf65d31fe45d3e3a504c71368861d029d15636f14d39a4ee54
3
+ metadata.gz: 9a1d1b9e1ea3e38708c95820afb2f51fadfffb6818e50486824cb746a7a17d5f
4
+ data.tar.gz: 2e1460681ef3295e3fa891d3f4cf81210a858f6eaffe2e33cbc5dde96e6a0dd4
5
5
  SHA512:
6
- metadata.gz: 84c97fec983bf5925e23b6726896faa2de2a1fef1ca36c78669165da1a1044cba9ebf983efdd59963e63791daa65858b492db22efa054f5f6ac84bb8b87be00b
7
- data.tar.gz: 8564d86036ae326e3c5692304a14a4319092b02f7f964ef674ed7970c5bcedaac5aea40b2e3823eb6e0e59f6e6d17b068d7d8718acd580f0fdd8f348ac3ad3ff
6
+ metadata.gz: 5afd725d1f5da3bae74dd12e8411eab77c8121d50052dd4a883bd9b850ce35380e08106c3c4fc437061ecb1b1ea13da81392d8a06728a9d5d1ee995ff653c69b
7
+ data.tar.gz: 25730e82e8b5756d5bd929dc8a2bb026dd27250bb8c5f7147e2daae5bcd5c0b49051b557bd2560e865600aae4de5396833b6c12b8bb2dd5632db408f56c472bb
@@ -0,0 +1,86 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane_core/print_table'
3
+ require_relative '../helper/emerge_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class EmergeComment < Action
8
+ def self.run(params)
9
+ url = 'https://api.emergetools.com/getComment'
10
+ api_token = params[:api_token]
11
+ gitlab_url = params[:gitlab_url]
12
+ project_id = params[:gitlab_project_id]
13
+ pr_number = params[:pr_number]
14
+ gitlab_access_token = params[:gitlab_access_token]
15
+
16
+ requestParams = {
17
+ buildId: params[:build_id],
18
+ baseBuildId: params[:base_build_id]
19
+ }
20
+ resp = Faraday.get(url, requestParams, {'x-api-token' => api_token})
21
+ case resp.status
22
+ when 200
23
+ UI.message("Received comment from Emerge")
24
+ baseURL = gitlab_url ? gitlab_url : "https://gitlab.com"
25
+ url = "#{baseURL}/api/v4/projects/#{project_id}/merge_requests/#{pr_number}/notes"
26
+ gitlabResponse = Faraday.post(url, {"body" => resp.body}, {'Authorization' => "Bearer #{gitlab_access_token}"})
27
+ case gitlabResponse.status
28
+ when 200...299
29
+ UI.message("Successfully posted comment")
30
+ else
31
+ UI.error("Received error #{gitlabResponse.status} from Gitlab")
32
+ end
33
+ else
34
+ UI.error("Received error #{resp.status} from Emerge")
35
+ end
36
+ end
37
+
38
+ def self.description
39
+ "Post an Emerge PR comment, currently supports Gitlab only."
40
+ end
41
+
42
+ def self.authors
43
+ ["Emerge Tools"]
44
+ end
45
+
46
+ def self.available_options
47
+ [
48
+ FastlaneCore::ConfigItem.new(key: :api_token,
49
+ env_name: "EMERGE_API_TOKEN",
50
+ description: "An API token for Emerge",
51
+ optional: false,
52
+ type: String),
53
+ FastlaneCore::ConfigItem.new(key: :gitlab_acces_token,
54
+ env_name: "GITLAB_ACCESS_TOKEN",
55
+ description: "An access token for Gitlab",
56
+ optional: false,
57
+ type: String),
58
+ FastlaneCore::ConfigItem.new(key: :pr_number,
59
+ description: "The PR number that triggered this upload",
60
+ optional: false,
61
+ type: String),
62
+ FastlaneCore::ConfigItem.new(key: :build_id,
63
+ description: "A string to identify this build",
64
+ optional: false,
65
+ type: String),
66
+ FastlaneCore::ConfigItem.new(key: :base_build_id,
67
+ description: "Id of the build to compare with this upload",
68
+ optional: false,
69
+ type: String),
70
+ FastlaneCore::ConfigItem.new(key: :gitlab_url,
71
+ description: "URL of the self hosted gitlab instance",
72
+ optional: true,
73
+ type: String),
74
+ FastlaneCore::ConfigItem.new(key: :gitlab_project_id,
75
+ description: "Id of the gitlab project this upload was triggered from",
76
+ optional: false,
77
+ type: Integer)
78
+ ]
79
+ end
80
+
81
+ def self.is_supported?(platform)
82
+ platform == :ios
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Emerge
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-emerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerge Tools, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-13 00:00:00.000000000 Z
11
+ date: 2021-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -160,6 +160,7 @@ files:
160
160
  - README.md
161
161
  - lib/fastlane/plugin/emerge.rb
162
162
  - lib/fastlane/plugin/emerge/actions/emerge_action.rb
163
+ - lib/fastlane/plugin/emerge/actions/emerge_comment_action.rb
163
164
  - lib/fastlane/plugin/emerge/helper/emerge_helper.rb
164
165
  - lib/fastlane/plugin/emerge/version.rb
165
166
  homepage: https://github.com/EmergeTools/fastlane-plugin-emerge