Skip to content

Commit e238496

Browse files
committed
Show step summary after running script
1 parent fd5883e commit e238496

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

exe/importmap-update

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,29 @@ report.outcomes.each do |o|
105105
end
106106
report.warnings.each { |w| warn " ! #{w}" }
107107

108+
if (summary_path = ENV["GITHUB_STEP_SUMMARY"])
109+
File.open(summary_path, "a") do |f|
110+
f.puts "### Update summary"
111+
f.puts ""
112+
f.puts "Dry run: #{options[:dry_run]}"
113+
f.puts ""
114+
if plan.warnings.any?
115+
f.puts "**Plan warnings:**"
116+
f.puts ""
117+
plan.warnings.each { |w| f.puts "- #{w}" }
118+
f.puts ""
119+
end
120+
f.puts "Reconciler ignored #{reconciled.ignored.size} foreign PR(s)."
121+
f.puts ""
122+
f.puts "| Branch | PR | Action | Status | Detail |"
123+
f.puts "| --- | --- | --- | --- | --- |"
124+
report.outcomes.each do |o|
125+
f.puts "| #{o.branch || "?"} | #{o.pr_number ? "##{o.pr_number}" : ""} | #{o.type} | #{o.status} | #{o.detail} |"
126+
end
127+
report.warnings.each { |w| f.puts "> [!WARNING]" ; f.puts "> #{w}" }
128+
end
129+
end
130+
108131
# Exit non-zero only if any non-skipped outcome failed; in dry run all are
109132
# skipped, which is a successful run.
110133
exit(report.outcomes.any?(&:failed?) ? 1 : 0)

0 commit comments

Comments
 (0)