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 7bdad52 commit 0d52212
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,21 @@ jobs:
ORS = "";
}
NR==FNR {
prev_pkgs[$1] = $0;
# Process the previous section
split($0, parts, "- ");
prev_pkgs[parts[1]] = $0;
next;
}
{
pkg_name = $1;
current_line = $0;
# Process the current section
split($0, parts, "- ");
pkg_name = parts[1];
if (pkg_name in prev_pkgs) {
old_line = prev_pkgs[pkg_name];
delete prev_pkgs[pkg_name];
if (old_line != current_line) {
if (old_line != $0) {
split(old_line, old_parts, "- ");
split(current_line, new_parts, "- ");
printf "%s: %s -> %s\n", pkg_name, old_parts[1], new_parts[1];
printf "%s: %s -> %s\n", parts[2], old_parts[1], parts[1];
}
}
}
Expand All @@ -183,6 +185,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 0d52212

Please sign in to comment.