check_for_differences 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. set -x
  3. # Clone the source repository
  4. rm -rf source_data
  5. git clone https://github.com/disposable-email-domains/disposable-email-domains.git source_data && \
  6. # Create what would be generated by source_data
  7. python bin/parse_source_data > disposable_email_domains/__init__.py && \
  8. # See if anything has changed
  9. git diff --exit-code
  10. CHANGES=$?
  11. if [ -z "${TEST_ONLY}" ] && [ $CHANGES != 0 ]; then
  12. # Git setup
  13. git config --global user.email 'dee-eye@users.noreply.github.com'
  14. git config --global user.name "Dee Eye"
  15. git remote rm origin
  16. git remote add origin https://dee-eye:$OAUTH_TOKEN@github.com/disposable-email-domains/python-disposable-email-domains.git
  17. # Bump the version
  18. pip install bump
  19. VERSION=`bump`
  20. # Add changes, push and make a PR
  21. git checkout -b version-$VERSION
  22. git commit -am "Version $VERSION"
  23. git push -f origin HEAD
  24. curl --show-error --fail -u "dee-eye:$OAUTH_TOKEN" --data '{"title": "'"Version $VERSION"'", "head": "'"version-$VERSION"'", "base": "master"}' https://api.github.com/repos/disposable-email-domains/python-disposable-email-domains/pulls
  25. exit $?
  26. else
  27. exit $CHANGES
  28. fi