Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,15 @@ runs:
shell: bash
working-directory: ${{ inputs.rails-root }}
run: |
AUDIT_OUTPUT=$(bin/importmap audit 2>&1 || true)
OUTDATED_OUTPUT=$(bin/importmap outdated 2>&1 || true)

echo "## Importmap Update" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Vulnerabilities" >> $GITHUB_STEP_SUMMARY

echo "$AUDIT_OUTPUT" >> $GITHUB_STEP_SUMMARY

echo "" >> $GITHUB_STEP_SUMMARY
echo "### Outdated packages" >> $GITHUB_STEP_SUMMARY
echo "$OUTDATED_OUTPUT" >> $GITHUB_STEP_SUMMARY

{
echo 'importmap-audit<<IMPORTMAP_AUDIT_OUTPUT'
echo "$AUDIT_OUTPUT"
bin/importmap audit 2>&1 || true
echo 'IMPORTMAP_AUDIT_OUTPUT'
} >> "$GITHUB_OUTPUT"

{
echo 'importmap-outdated<<IMPORTMAP_OUTDATED_OUTPUT'
echo "$OUTDATED_OUTPUT"
bin/importmap outdated 2>&1 || true
echo 'IMPORTMAP_OUTDATED_OUTPUT'
} >> "$GITHUB_OUTPUT"

Expand Down
31 changes: 31 additions & 0 deletions exe/importmap-update
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,37 @@ report.outcomes.each do |o|
end
report.warnings.each { |w| warn " ! #{w}" }

if (summary_path = ENV["GITHUB_STEP_SUMMARY"])
File.open(summary_path, "a") do |f|
f.puts "### Update summary"
f.puts "Dry run: #{options[:dry_run]}"

if plan.warnings.any?
f.puts "#### Plan warnings"
plan.warnings.each { |w| f.puts "- #{w}" }
end

f.puts ""
f.puts "Reconciler ignored #{reconciled.ignored.size} foreign PR(s)."
f.puts ""

if report.outcomes.any?
f.puts "#### Outcomes"
f.puts "| Branch | PR | Action | Status | Detail |"
f.puts "| --- | --- | --- | --- | --- |"
report.outcomes.each do |o|
f.puts "| #{o.branch || "?"} | #{"##{o.pr_number}" if o.pr_number} | #{o.type} | #{o.status} | #{o.detail} |"
end
end

report.warnings.each { |w|
f.puts ""
f.puts "> [!WARNING]"
f.puts "> #{w}"
}
end
end

# Exit non-zero only if any non-skipped outcome failed; in dry run all are
# skipped, which is a successful run.
exit(report.outcomes.any?(&:failed?) ? 1 : 0)