fastlane-plugin-emerge 0.10.4 → 0.10.6

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: 5af3be7b1a251da05592383703e74d646beeffe6ed7bc50cc4e139f662332d3c
4
- data.tar.gz: ae2179ef90e77a6916a75f0a0265d94bfd2aec7205d90ad4187d891266aba756
3
+ metadata.gz: 6b3fdf2609746465c109005ada64d6fb3934e0930bd900e448b60551fcffbc4b
4
+ data.tar.gz: 55c71ed30681633f8a7e2736302f8b3c209c5f0a11387dcb96a967376507b2bd
5
5
  SHA512:
6
- metadata.gz: 4feffe8f6cc285b4d634f8140b44432194308edf6a7c46e2e62fed0674527239a30ce814bd035763444b8fa3c3e81950ab08d700c01486762a61e0cb1c693509
7
- data.tar.gz: 943719d58ae8a684fd3bfd31b6c74c693ffc28b18d7be7945f0ed9e15d68fe39bd127545ca6090fde9678dcd24bfeeeb5382744eda6a596a354e4a2025689237
6
+ metadata.gz: f101d6387c86c67b746a89ebc2cdeeb71777d7a8942031bc49f968423668131fa8a9f4a4b5cedcdd00fb55c9d1e7323a810f6f0fae739e00cd4ac3af05f5e972
7
+ data.tar.gz: d8a28c08d15a438b24e9c15a153897cec5749fc2bfab57e8966fe232ba804bb560f19c13743402e335f9e07b4f83a4b75aec06ebff7fda1825144dc55fd16e84
data/README.md CHANGED
@@ -52,12 +52,13 @@ For a full list of available parameters run `fastlane action emerge_snapshot`.
52
52
 
53
53
  ## Git Configuration
54
54
 
55
- For build comparisons to work, Emerge needs the appropriate Git `sha` and `base_sha` values set on each build. Emerge will automatically compare a build at `sha` against the build we find matching the `base_sha` for a given application id. We also recommend setting `pr_number`, `branch`, and `repo_name` for the best experience.
55
+ For build comparisons to work, Emerge needs the appropriate Git `sha` and `base_sha` values set on each build. Emerge will automatically compare a build at `sha` against the build we find matching the `base_sha` for a given application id. We also recommend setting `pr_number`, `branch`, `repo_name`, and `previous_sha` for the best experience.
56
56
 
57
57
  For example:
58
58
 
59
- - `sha`: `pr-branch-commit-1`
59
+ - `sha`: `pr-branch-commit-2`
60
60
  - `base_sha`: `main-branch-commit-1`
61
+ - `previous_sha`: `pr-branch-commit-1`
61
62
  - `pr_number`: `42`
62
63
  - `branch`: `my-awesome-feature`
63
64
  - `repo_name`: `EmergeTools/hackernews`
@@ -30,6 +30,7 @@ module Fastlane
30
30
  branch = params[:branch] || git_params.branch
31
31
  sha = params[:sha] || params[:build_id] || git_params.sha
32
32
  base_sha = params[:base_sha] || params[:base_build_id] || git_params.base_sha
33
+ previous_sha = params[:previous_sha] || git_params.previous_sha
33
34
  repo_name = params[:repo_name] || git_params.repo_name
34
35
  gitlab_project_id = params[:gitlab_project_id]
35
36
  tag = params[:tag]
@@ -105,6 +106,7 @@ module Fastlane
105
106
  branch: branch,
106
107
  sha: sha,
107
108
  baseSha: base_sha,
109
+ previousSha: previous_sha,
108
110
  repoName: repo_name,
109
111
  gitlabProjectId: gitlab_project_id,
110
112
  orderFileVersion: order_file_version,
@@ -172,6 +174,10 @@ module Fastlane
172
174
  description: "The git SHA of the base build",
173
175
  optional: true,
174
176
  type: String),
177
+ FastlaneCore::ConfigItem.new(key: :previous_sha,
178
+ description: "The git SHA of the commit right before this build's commit",
179
+ optional: true,
180
+ type: String),
175
181
  FastlaneCore::ConfigItem.new(key: :build_id,
176
182
  description: "A string to identify this build",
177
183
  deprecated: "Replaced by `sha`",
@@ -19,6 +19,7 @@ module Fastlane
19
19
  branch = params[:branch] || git_params.branch
20
20
  sha = params[:sha] || git_params.sha
21
21
  base_sha = params[:base_sha] || git_params.base_sha
22
+ previous_sha = params[:previous_sha] || git_params.previous_sha
22
23
  repo_name = params[:repo_name] || git_params.repo_name
23
24
  gitlab_project_id = params[:gitlab_project_id]
24
25
  tag = params[:tag]
@@ -54,6 +55,7 @@ module Fastlane
54
55
  branch: branch,
55
56
  sha: sha,
56
57
  baseSha: base_sha,
58
+ previousSha: previous_sha,
57
59
  repoName: repo_name,
58
60
  gitlabProjectId: gitlab_project_id,
59
61
  tag: tag || "default"
@@ -133,6 +135,10 @@ module Fastlane
133
135
  description: "The git SHA of the base build",
134
136
  optional: true,
135
137
  type: String),
138
+ FastlaneCore::ConfigItem.new(key: :previous_sha,
139
+ description: "The git SHA of the commit right before this build's commit",
140
+ optional: true,
141
+ type: String),
136
142
  FastlaneCore::ConfigItem.new(key: :repo_name,
137
143
  description: "Full name of the respository this upload was triggered from. For example: EmergeTools/Emerge",
138
144
  optional: true,
@@ -5,12 +5,13 @@ module Fastlane
5
5
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
6
 
7
7
  class GitResult
8
- attr_accessor :sha, :base_sha, :branch, :pr_number, :repo_name
8
+ attr_accessor :sha, :base_sha, :previous_sha, :branch, :pr_number, :repo_name
9
9
 
10
- def initialize(sha:, base_sha:, branch:, pr_number: nil, repo_name: nil)
10
+ def initialize(sha:, base_sha:, previous_sha:, branch:, pr_number: nil, repo_name: nil)
11
11
  @pr_number = pr_number
12
12
  @sha = sha
13
13
  @base_sha = base_sha
14
+ @previous_sha = previous_sha
14
15
  @branch = branch
15
16
  @repo_name = repo_name
16
17
  end
@@ -36,6 +37,7 @@ module Fastlane
36
37
  GitResult.new(
37
38
  sha: Helper::Github.sha,
38
39
  base_sha: Helper::Github.base_sha,
40
+ previous_sha: Helper::Github.previous_sha,
39
41
  branch: Helper::Github.branch,
40
42
  pr_number: Helper::Github.pr_number,
41
43
  repo_name: Helper::Github.repo_name
@@ -45,6 +47,7 @@ module Fastlane
45
47
  GitResult.new(
46
48
  sha: Helper::Git.sha,
47
49
  base_sha: Helper::Git.base_sha,
50
+ previous_sha: Helper::Git.previous_sha,
48
51
  branch: Helper::Git.branch
49
52
  )
50
53
  end
@@ -60,6 +60,13 @@ module Fastlane
60
60
  stdout.strip == current_sha ? nil : stdout.strip
61
61
  end
62
62
 
63
+ def self.previous_sha
64
+ shell_command = "git rev-parse HEAD^"
65
+ UI.command(shell_command)
66
+ stdout, _, status = Open3.capture3(shell_command)
67
+ stdout.strip if status.success?
68
+ end
69
+
63
70
  def self.primary_remote
64
71
  remote = remote()
65
72
  return nil if remote.nil?
@@ -39,6 +39,12 @@ module Fastlane
39
39
  end
40
40
  end
41
41
 
42
+ def self.previous_sha
43
+ if is_push?
44
+ github_event_data.dig(:before)
45
+ end
46
+ end
47
+
42
48
  def self.pr_number
43
49
  is_pull_request? ? github_event_data.dig(:number) : nil
44
50
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Emerge
3
- VERSION = "0.10.4"
3
+ VERSION = "0.10.6"
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.10.4
4
+ version: 0.10.6
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: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday