mirror of
https://github.com/postlight/mercury-parser
synced 2024-11-11 01:10:35 +00:00
29 lines
727 B
Bash
Executable File
29 lines
727 B
Bash
Executable File
#!/bin/bash
|
|
|
|
changes=( `git diff origin/master --name-only` )
|
|
|
|
for fixture in "${changes[@]}"
|
|
do
|
|
# If one of the changed files is a fixture, hold onto it
|
|
if [[ $fixture == "fixtures/"* ]]; then
|
|
fixtures=$fixture,$fixtures
|
|
fi
|
|
done
|
|
|
|
if [[ $fixtures ]]; then
|
|
# Take a screenshot of the fixture
|
|
yarn phantomjs scripts/generate-fixture-preview.js $fixtures
|
|
|
|
screenshots=( `find tmp/artifacts -type f | grep ".html.png"` )
|
|
|
|
for screenshot in "${screenshots[@]}"
|
|
do
|
|
# Create a comment with a link to the screenshot
|
|
# and json output for the fixture
|
|
node scripts/comment-for-pr.js $screenshot
|
|
done
|
|
else
|
|
echo "No fixtures added in this PR, so no preview needed"
|
|
node scripts/write-test-report.js
|
|
fi
|