Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] fix for more forgiving changelog generation for release #20851

Merged
merged 1 commit into from Nov 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 24 additions & 4 deletions fastlane/Fastfile
Expand Up @@ -365,16 +365,36 @@ private_lane :github_changelog do |options|
body = JSON.parse(pr_resp[:body])
items = body["items"]

if items.size == 1
item = items.first
item_infos = items.map do |item|
message = "#{item['title']} (##{item['number']})"
username = item["user"]["login"]

[message, username]
end

if item_infos.size == 0
if UI.confirm("Error generating changelog. No commit found for #{sha}. Skip?")
next
else
UI.user_error!("Cannot generate changelog. No commit found for #{sha}")
end
elsif item_infos.size == 1
message = item_infos[0][0]
username = item_infos[0][1]
else
UI.user_error!("Cannot generate changelog. Multiple commits found for #{sha}")
options = item_infos.map do |item|
"#{item[1]} - #{item[0]})"
end

option = UI.select("Which changelog?", options)
index = options.index(option)

message = item_infos[index][0]
username = item_infos[index][1]
end

"* #{message} via #{name} (@#{username})"
end.join("\n")
end.compact.join("\n")

formatted
end
Expand Down