fix(ci): updates to notices and pull request generators (#16523)

This commit is contained in:
Nick Cooke authored and GitHub committed 2026-08-19 14:35:12 -07:00
1 parent 098f532e67
commit 956c846935
2 files changed
+22 -8

No files matched your search

+12 -4
View File
@@ -16,6 +16,7 @@
require 'cocoapods'
require 'digest'
require 'open3'
require 'optparse'
require 'plist'
require 'tmpdir'
@@ -67,7 +68,7 @@ def create_podfile(path: , sources: , target: , pods: [], min_ios_version: , sea
if source == "https://cdn.cocoapods.org/"
next
end
`pod repo add #{Digest::MD5.hexdigest source} #{source}`
system('pod', 'repo', 'add', Digest::SHA256.hexdigest(source), source)
end
end
output += "use_frameworks! :linkage => :static\n"
@@ -77,11 +78,18 @@ def create_podfile(path: , sources: , target: , pods: [], min_ios_version: , sea
for pod in pods do
if search_local_pod_version
# `pod search` will search a pod locally and generate a corresonding pod
# config in a Podfile with `grep`, e.g.
# pod search Firebase | grep "pod '.*" -m 1
# config in a Podfile with ruby match, e.g.
# pod search Firebase
# will generate
# pod 'Firebase', '~> 9.0.0'
output += `pod search "#{pod}" | grep "pod '.*" -m 1`
stdout, status = Open3.capture2('pod', 'search', pod)
match = status.success? ? stdout.match(/pod '.*/) : nil
if match
output += "#{match[0]}\n"
else
puts "Warning: pod search failed or found no match for '#{pod}'. Falling back to unversioned pod."
output += "pod \'#{pod}\'\n"
end
else
output += "pod \'#{pod}\'\n"
end
+10 -4
View File
@@ -52,11 +52,17 @@ BASE_BRANCH=@options[:base_branch]
COMMIT_COMMENT=@options[:commit_comment]
def generate_pr_for_target_changes(repo_root:, target_path:)
if `git diff #{TARGET_PATH}`==""
puts "The file, #{TARGET_PATH}, has no changes."
return
abs_target_path = File.expand_path(target_path)
Dir.chdir(repo_root) do
if system('git', 'diff', '--quiet', abs_target_path)
puts "The file, #{target_path}, has no changes."
return
end
system('git', 'checkout', '-B', BASE_BRANCH) || raise("git checkout failed")
system('git', 'add', abs_target_path) || raise("git add failed")
system('git', 'commit', '-m', COMMIT_COMMENT) || raise("git commit failed")
system('git', 'push', '-u', 'origin', BASE_BRANCH) || raise("git push failed")
end
system("cd #{REPO_ROOT}\ngit checkout -b #{BASE_BRANCH}\ngit add #{TARGET_PATH}\ngit commit -m \"#{COMMIT_COMMENT}\"\ngit push -u origin #{BASE_BRANCH}")
client = Octokit::Client.new(access_token: ACCESS_TOKEN)
client.create_pull_request("firebase/firebase-ios-sdk", "main", BASE_BRANCH, PR_TITLE, PR_BODY)
end