fastlane-plugin-stream_actions 0.4.0 → 0.4.1

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: da3b36b0e6522ca379318f8ad60da491bf4142410448906362262a0cac7752be
4
- data.tar.gz: 5ab21d748b882e41449e65689cb4d8f0b57995a87886c9a0712f6ebd9f969149
3
+ metadata.gz: 98ea1940f8aa3135975f332a499eb1d755e31f01c5d5bedb28f19d807fd164ea
4
+ data.tar.gz: c583a39f54b3acc092486c66877c9453bd6fb9e2b0013b02bad309e9e7165c33
5
5
  SHA512:
6
- metadata.gz: 909b117ee8f4b36290a3aa1c3df805d273e76523dc99eff987a6a6d11973a99f28bf20e491943c4fe00cb041fedf56b946330f7a6e4256f7cea6d8b7e9305b3d
7
- data.tar.gz: 66b9a04b4941b8be74fa1dde59aa06a1a77c8463dff240d856fba76d8ef7c02f51529990dc8330879dd4174279001bd7fe5f84df02cc0b89dac07df8d3047581
6
+ metadata.gz: ecdaab8fb0a7311bdd636132be1ee212c60d40935df5787a3d13c6284dd262c6274310995f73119f5bf14993ea34ca154b1979240452902299f9a31b648bc0bc
7
+ data.tar.gz: 204c24b4512c844608a14e7555de811fd8c20f4a40084548c1fe975c0dca6e229bbe29d2cbbf43a58d101149157ef4744ab9f92502c4c780c2754d693ade5b8a
@@ -6,11 +6,11 @@ module Fastlane
6
6
 
7
7
  UI.message("Checking if check is required for PR ##{params[:github_pr_num]}")
8
8
 
9
- changed_files = Actions.sh("gh pr view #{params[:github_pr_num]} --json files -q '.files[].path'").split("\n")
9
+ changed_files = self.changed_file_paths(params)
10
10
 
11
11
  too_many_files = changed_files.size > 99 # TODO: https://github.com/cli/cli/issues/5368
12
12
  if too_many_files
13
- UI.important("Check it required because there were too many files changed.")
13
+ UI.important("Check is required because there were too many files changed.")
14
14
  return true
15
15
  end
16
16
 
@@ -23,6 +23,42 @@ module Fastlane
23
23
  is_check_required
24
24
  end
25
25
 
26
+ # For pull_request: use full PR for `opened` (etc.); for `synchronize` pass
27
+ # github_event_before/after (e.g. github.event.before/after) to scope to this push.
28
+ def self.changed_file_paths(params)
29
+ action = params[:github_event_action].to_s
30
+ before = params[:github_event_before].to_s.strip
31
+ after = params[:github_event_after].to_s.strip
32
+ repo = (params[:github_repository] || ENV['GITHUB_REPOSITORY']).to_s
33
+
34
+ if action == 'synchronize' && !before.empty? && !after.empty? && !repo.empty?
35
+ if before.match?(/\A0+\z/) || !before.match?(/\A[0-9a-f]{7,40}\z/i) || !after.match?(/\A[0-9a-f]{7,40}\z/i)
36
+ UI.important("Invalid before/after for compare; falling back to full PR file list")
37
+ else
38
+ out = self.compare_push_files(repo, before, after)
39
+ return out unless out.nil?
40
+
41
+ UI.important("Could not list push diff (e.g. fork/cross-repo); falling back to full PR file list")
42
+ end
43
+ end
44
+
45
+ self.gh_path_lines(Actions.sh("gh pr view #{params[:github_pr_num]} --json files -q '.files[].path'"))
46
+ end
47
+
48
+ def self.compare_push_files(repo, before, after)
49
+ self.gh_path_lines(Actions.sh(
50
+ "gh api \"repos/#{repo}/compare/#{before}...#{after}\" " \
51
+ "-H \"Accept: application/vnd.github.v3+json\" " \
52
+ "-q '.files[].filename'"
53
+ ))
54
+ rescue StandardError
55
+ nil
56
+ end
57
+
58
+ def self.gh_path_lines(output)
59
+ output.to_s.split("\n", -1).map(&:strip).reject(&:empty?)
60
+ end
61
+
26
62
  #####################################################
27
63
  # @!group Documentation
28
64
  #####################################################
@@ -52,6 +88,31 @@ module Fastlane
52
88
  description: 'GitHub PR number',
53
89
  optional: true,
54
90
  is_string: false
91
+ ),
92
+ FastlaneCore::ConfigItem.new(
93
+ env_name: 'GITHUB_EVENT_ACTION',
94
+ key: :github_event_action,
95
+ description: 'pull_request action: e.g. opened, synchronize. When synchronize and before/after ' \
96
+ 'are set, only files in that push are considered',
97
+ optional: true
98
+ ),
99
+ FastlaneCore::ConfigItem.new(
100
+ env_name: 'GITHUB_EVENT_BEFORE',
101
+ key: :github_event_before,
102
+ description: 'github.event.before (head ref before the push) for pull_request',
103
+ optional: true
104
+ ),
105
+ FastlaneCore::ConfigItem.new(
106
+ env_name: 'GITHUB_EVENT_AFTER',
107
+ key: :github_event_after,
108
+ description: 'github.event.after (head ref after the push) for pull_request',
109
+ optional: true
110
+ ),
111
+ FastlaneCore::ConfigItem.new(
112
+ env_name: 'GITHUB_REPOSITORY',
113
+ key: :github_repository,
114
+ description: 'owner/repo; required for push-scoped file list (defaults to GITHUB_REPOSITORY in CI)',
115
+ optional: true
55
116
  )
56
117
  ]
57
118
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-24 00:00:00.000000000 Z
11
+ date: 2026-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list