Skip to content

Commit

Permalink
Just error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
markbrough committed Jan 24, 2019
1 parent 8ef087d commit ef27dc3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scraper.py
Expand Up @@ -5,6 +5,7 @@
import requests
import shutil
from git import Repo
from git.exc import GitCommandError
from os.path import join
from os import environ, remove
from glob import glob
Expand Down Expand Up @@ -46,13 +47,13 @@ def push_to_github():
url = 'https://api.github.com/repos/markbrough/country-fiscal-years/pulls'
git = Repo.init(output_dir).git
result = git.add('.')
if len(result) == 0:
print("No updates required!")
return True

git.config('user.email', environ.get('MORPH_GH_EMAIL'))
git.config('user.name', environ.get('MORPH_GH_USERNAME'))
git.commit(m='Update')
try:
git.commit(m='Update')
except GitCommandError:
print "Nothing to commit!"
return True
git.push('origin', 'update')
payload = {
'title': 'Merge in latest changes',
Expand Down

0 comments on commit ef27dc3

Please sign in to comment.