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 c736b0b commit 3accebe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
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')
awk -v section="$section" '
awk '
BEGIN {
FS = "- ";
ORS = "";
Expand All @@ -161,17 +161,17 @@ jobs:
if (old_line != current_line) {
split(old_line, old_parts, "- ");
split(current_line, new_parts, "- ");
printf "%s %s -> %s\n", pkg_name, old_parts[2], new_parts[2];
printf "%s %s -> %s\n", old_parts[2], old_parts[1], new_parts[1];
}
} else {
split(current_line, new_parts, "- ");
printf "%s %s -> (added)\n", pkg_name, new_parts[2];
printf "%s %s -> (added)\n", new_parts[2], new_parts[1];
}
}
END {
for (pkg_name in prev_pkgs) {
split(prev_pkgs[pkg_name], old_parts, "- ");
printf "%s %s -> (removed)\n", pkg_name, old_parts[2];
printf "%s %s -> (removed)\n", old_parts[2], old_parts[1];
}
}
' <(echo "$previous_section") <(echo "$current_section")
Expand All @@ -192,6 +192,7 @@ jobs:
echo -e "$FORMATTED_DIFF" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Send Slack Notification
# if: ${{ github.ref == 'refs/heads/master' && env.DIFF_OUTPUT != '' }}
uses: slackapi/[email protected]
Expand Down

0 comments on commit 3accebe

Please sign in to comment.