Skip to content

Commit 1e21bdc

Browse files
committed
Show only a summary after running script
1 parent fd5883e commit 1e21bdc

2 files changed

Lines changed: 33 additions & 15 deletions

File tree

action.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,15 @@ runs:
4242
shell: bash
4343
working-directory: ${{ inputs.rails-root }}
4444
run: |
45-
AUDIT_OUTPUT=$(bin/importmap audit 2>&1 || true)
46-
OUTDATED_OUTPUT=$(bin/importmap outdated 2>&1 || true)
47-
48-
echo "## Importmap Update" >> $GITHUB_STEP_SUMMARY
49-
echo "" >> $GITHUB_STEP_SUMMARY
50-
echo "### Vulnerabilities" >> $GITHUB_STEP_SUMMARY
51-
52-
echo "$AUDIT_OUTPUT" >> $GITHUB_STEP_SUMMARY
53-
54-
echo "" >> $GITHUB_STEP_SUMMARY
55-
echo "### Outdated packages" >> $GITHUB_STEP_SUMMARY
56-
echo "$OUTDATED_OUTPUT" >> $GITHUB_STEP_SUMMARY
57-
5845
{
5946
echo 'importmap-audit<<IMPORTMAP_AUDIT_OUTPUT'
60-
echo "$AUDIT_OUTPUT"
47+
bin/importmap audit 2>&1 || true
6148
echo 'IMPORTMAP_AUDIT_OUTPUT'
6249
} >> "$GITHUB_OUTPUT"
6350
6451
{
6552
echo 'importmap-outdated<<IMPORTMAP_OUTDATED_OUTPUT'
66-
echo "$OUTDATED_OUTPUT"
53+
bin/importmap outdated 2>&1 || true
6754
echo 'IMPORTMAP_OUTDATED_OUTPUT'
6855
} >> "$GITHUB_OUTPUT"
6956

exe/importmap-update

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,37 @@ 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 "Dry run: #{options[:dry_run]}"
112+
113+
if plan.warnings.any?
114+
f.puts "#### Plan warnings"
115+
plan.warnings.each { |w| f.puts "- #{w}" }
116+
end
117+
118+
f.puts ""
119+
f.puts "Reconciler ignored #{reconciled.ignored.size} foreign PR(s)."
120+
f.puts ""
121+
122+
if report.outcomes.any?
123+
f.puts "#### Outcomes"
124+
f.puts "| Branch | PR | Action | Status | Detail |"
125+
f.puts "| --- | --- | --- | --- | --- |"
126+
report.outcomes.each do |o|
127+
f.puts "| #{o.branch || "?"} | #{"##{o.pr_number}" if o.pr_number} | #{o.type} | #{o.status} | #{o.detail} |"
128+
end
129+
end
130+
131+
report.warnings.each { |w|
132+
f.puts ""
133+
f.puts "> [!WARNING]"
134+
f.puts "> #{w}"
135+
}
136+
end
137+
end
138+
108139
# Exit non-zero only if any non-skipped outcome failed; in dry run all are
109140
# skipped, which is a successful run.
110141
exit(report.outcomes.any?(&:failed?) ? 1 : 0)

0 commit comments

Comments
 (0)