Skip to content

Commit

Permalink
Show added images
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed May 29, 2023
1 parent 6359a51 commit 589d7af
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/dvc-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,32 @@ jobs:
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
run: |
# Summary of changed images
echo -e "## Summary of changed images\n" > report.md
echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md
dvc diff --show-md main HEAD >> report.md
# Get just the filename of the added and modified image from the report
awk 'NF==5 && NR>=7 && $2=="added" {print $4}' report.md > added_files.txt
awk 'NF==5 && NR>=7 && $2=="modified" {print $4}' report.md > modified_files.txt
# Append each image to the markdown report
echo -e "## Image diff(s)\n" >> report.md
echo -e "<details>\n" >> report.md
# Added images
echo -e "### Added images\n" >> report.md
while IFS= read -r line; do
echo -e "- $line \n" >> report.md
echo -e "![$line]($line)" >> report.md
done < added_files.txt
echo -e "</details>\n" >> report.md
# Mention git commit SHA in the report
echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md
# create/update the PR comment
cml comment update report.md
- name: Generate the image diff report
Expand Down

0 comments on commit 589d7af

Please sign in to comment.