Skip to content

Commit 589d7af

Browse files
committed
Show added images
1 parent 6359a51 commit 589d7af

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/dvc-diff.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,32 @@ jobs:
4949
env:
5050
repo_token: ${{ secrets.GITHUB_TOKEN }}
5151
run: |
52+
# Summary of changed images
5253
echo -e "## Summary of changed images\n" > report.md
5354
echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md
5455
dvc diff --show-md main HEAD >> report.md
56+
57+
# Get just the filename of the added and modified image from the report
58+
awk 'NF==5 && NR>=7 && $2=="added" {print $4}' report.md > added_files.txt
59+
awk 'NF==5 && NR>=7 && $2=="modified" {print $4}' report.md > modified_files.txt
60+
61+
# Append each image to the markdown report
62+
echo -e "## Image diff(s)\n" >> report.md
63+
echo -e "<details>\n" >> report.md
64+
65+
# Added images
66+
echo -e "### Added images\n" >> report.md
67+
while IFS= read -r line; do
68+
echo -e "- $line \n" >> report.md
69+
echo -e "![$line]($line)" >> report.md
70+
done < added_files.txt
71+
72+
echo -e "</details>\n" >> report.md
73+
74+
# Mention git commit SHA in the report
75+
echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md
76+
77+
# create/update the PR comment
5578
cml comment update report.md
5679
5780
- name: Generate the image diff report

0 commit comments

Comments
 (0)