Skip to content

Commit

Permalink
echo formatted diff into the cli
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderM91 committed Dec 2, 2024
1 parent aa01a9a commit 12cc0ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,16 @@ jobs:
current_file="current-image-report.txt"
previous_file="previous-image-report.txt"
current_section=$(sed -n "/=== $section ===/,/=== /p" "$current_file" | sed '$d')
previous_section=$(sed -n "/=== $section ===/,/=== /p" "$previous_file" | sed '$d')
current_section=$(sed -n "/=== $section ===/,/=== /p" "$current_file" | sed '1d;$d')
previous_section=$(sed -n "/=== $section ===/,/=== /p" "$previous_file" | sed '1d;$d')

if [[ "$section" == "Installed System Packages" ]]; then
# Special formatting for Installed System Packages
diff_output=$(diff <(echo "$previous_section") <(echo "$current_section") | awk '
/^</ { old_line = substr($0, 3); split(old_line, parts, " - "); old_pkg = parts[1]; old_desc = parts[2]; }
/^>/ { new_line = substr($0, 3); split(new_line, parts, " - "); new_pkg = parts[1]; new_desc = parts[2];
/^</ { old_line = substr($0, 3); split(old_line, parts, " - "); old_pkg = parts[1]; old_version_desc = parts[2]; }
/^>/ { new_line = substr($0, 3); split(new_line, parts, " - "); new_pkg = parts[1]; new_version_desc = parts[2];
if (old_pkg == new_pkg) {
print new_pkg ": " old_pkg " -> " new_pkg;
print old_pkg ": " old_version_desc " -> " new_version_desc;
}
}')
else
Expand Down

0 comments on commit 12cc0ab

Please sign in to comment.