Skip to content

Instantly share code, notes, and snippets.

@ygerasimov
Created April 21, 2020 13:46
Show Gist options
  • Save ygerasimov/36efe72613727dc48377aa2edf31af9e to your computer and use it in GitHub Desktop.
Save ygerasimov/36efe72613727dc48377aa2edf31af9e to your computer and use it in GitHub Desktop.
Diffy bitbucket compare script
#!/usr/bin/env bash
echo "==================================================="
echo "========== Run diffy compare and Bitbucket check =="
echo "==================================================="
API_KEY="$1"
PROJECT_ID=1194
DIFFY_HOST="https://app.diffy.website"
ENV1URL="http://test-diffy-marketing.pantheonsite.io/"
ENV2URL="http://dev-diffy-marketing.pantheonsite.io/"
DIFFY="./vendor/diffy-website/diffy-cli/diffy"
echo "============= Log in ======================="
php ${DIFFY} auth:login ${API_KEY}
echo "============= Start compare ================"
DIFF_ID=`php ${DIFFY} project:compare ${PROJECT_ID} custom custom --env1Url="${ENV1URL}" --env2Url="${ENV2URL}" --wait --max-wait="3600"`
echo "============= Diff created with ID ========="
echo ${DIFF_ID}
DIFF_STATUS=`php ${DIFFY} diff:get-status ${DIFF_ID}`
if [[ ${DIFF_STATUS} = "1" ]]; then
DIFF_PERCENT=`php ${DIFFY} diff:get-changes-percent ${DIFF_ID}`
echo "============= Diff changes percent ================"
echo ${DIFF_PERCENT}
if [[ ${DIFF_PERCENT} = "0" ]]; then
echo "============= Check successfully. ==============="
exit 0
else
echo "============= Check error. ======================"
echo "Details: ${DIFFY_HOST}/#/diffs/${DIFF_ID}"
exit 1
fi
else
echo "============= Diff has not been created ==========="
exit 1
fi
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment